How to select only one branch in bool query

I have a list of documents

    "shortName": "CA",
    "longName": "California"
    "shortName": "New York",
    "longName": "New York"

How to configure the query to select only the first field that matches, something like maximumSouldMatch=1

For example if I search New York, it should match only shortName but not both, as in this case the score will be doubled

I suppose you are using the nested query. You may want to take a look at the score_mode - I'm however not sure if that is exactly what you are searching for.

Sharing your mapping, index creation and query would probably help!.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.