Constant weight for each part in a bool query in Elasticsearch Constant weight for each part in a bool query in Elasticsearch elasticsearch elasticsearch

Constant weight for each part in a bool query in Elasticsearch


you could probably use constant score to achieve this anduse highlighting to figure out the fields that matched.

Example :

{   "query": {      "bool": {         "disable_coord": true,         "should": [            {               "constant_score": {                  "query": {                     "match": {                        "last_name": "Shcheklein"                     }                  },                  "boost": 1               }            },            {               "constant_score": {                  "query": {                     "match": {                        "first_name": "bart"                     }                  },                  "boost": 1               }            }         ]      }   }}