Minimum_should_match with nested objects

I am having some problems with a minimal request for compliance.

In my document, I have the following mapping for people of nested objects

"people": {
   "type": "nested",
   "properties": {
      "name": {
         "type": "string",
         "index": "not_analyzed"
       }
     }
}

I am trying to use a minimum_should_match subquery. This code is inside the nested area:

"bool": {
    "should": [
     {
       "terms": {
          "people.name": [
                 "Anna",
                 "Mark",
                 "Joe"
                 ],
           "minimum_should_match": "100%",
            "boost": 3
           }
        }
    ]
}

And even if a document with these three names is inside my index, I have no result.

Is there a problem with the nested data structure of people? I want to have a high score for documents with a higher name.

I tried with "execution" : "or"and I got

QueryParsingException[[my_db] [terms] query does not support [execution]

The only solution I found was to share each name with a different term expression inside the scope.

Will this affect the complexity of the request? Sometimes I have to search for documents with 30 names.

+4
1

:

"query": {
    "bool": {
        "should": [
            {"nested":
                {"path": "people",
                    "query": {
                        "terms" : {
                            "people.name" :["Anna", "Joe"]
                        }                           
                    }
                }
            }
        ]
      }
    }
0

Source: https://habr.com/ru/post/1607980/


All Articles