Opensearch Serverless more_like_this support

0

I'm attempting to move from an Opensearch Service domain to Opensearch Serverless, and one issue I've hit is that more_like_this queries using a set of input document ids do not return any matches, whereas the same query with the same data and mapping returns the expected results on the managed cluster (domain).

A minimal example of a query that works on the Opensearch domain but not on Serverless (collection type: search):

GET items/_search
{
  "query": {
    "more_like_this": {
      "fields": [
        "description",
        "section"
      ],
      "like": [
        {
          "_index": "items",
          "_id": "160319-16510"
        }
      ],
      "min_term_freq": 1,
      "max_query_terms": 25,
      "minimum_should_match": 1,
      "boost_terms": 1,
      "include": false,
      "boost": 2
    }
  }
}

If, instead of an array of document ids, like is given an array of strings, then both the managed domain and serverless collections provide the expected results.

If I provide the same array of document ids I used in the more_like_this->like object to the docs object in an /_mget API call, then the specified documents are returned, so the syntax and data appear to be correct.

I've gone as far as trying to trace the handling of the more_like_this->like input in the opensearch source code, but with only basic Java literacy and little familiarity with the source code layout, I wasn't able to do more than confirm that it seemed to agree with the more_like_this documentation from Elasticsearch. I was unable to find direct documentation of more_like_this for Opensearch, but since it dates from well before it was forked from Elasticsearch I expect it will be the same.

The Opensearch Service domain mapping currently does not set term_vector, but the more_like_this query works there. On Serverless I've tried without it, and setting term_vector to yes, but neither work.

Our use case relies on being able to express the query intent "return N documents that are similar to this given set of document ids, considering these fields, using TF/IDF". How do I do this on Opensearch Serverless?

Cyan
asked a month ago55 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions