Elasticsearch use the DSL format to create query.
One easy search is to use multi_match by passing the query key word, and give the fields to search for.
Here is an example:
|
The problem with the above query is that:if your query keyword is a phrase, you might find many results that have the exact match are ranked lower.
To solve this problem, you might want to try this new dsl format:
dsl={ |
one thing to explain in the above the query, is the ‘operator’; According to the official elasticsearch webpage:
operator and minimum_should_match
The best_fields and most_fields types are field-centric — they generate a match query per field. This means that the operator and minimum_should_match parameters are applied to each field individually, which is probably not what you want.
Take this query for example:
GET /_search |
This query is executed as:
(+first_name:will +first_name:smith)
| (+last_name:will +last_name:smith)
In other words, all terms must be present in a single field for a document to match.