Skip to content

Search Query

Daniel Whyte edited this page Aug 19, 2016 · 1 revision

ElasticSearch Query for Search

bool/should

The should query means that a document doesn't have to match these queries, but will receive a score boost for each one that it does, for example, if a query matches both the name and the description of the document, that document will receive a higher score than one that just matches the description. A document that does not match any of the queries will have no score.

multi_match

The multi match query lists a number of fields to match the query against, all equally weighted. These are the fields that are currently analyzed in the index.

match + boost

The identifier is in its own separate match query, with a boost of 200. This means that if there is an exact match on the identifier, it will be at the top of the results, most likely with no other results.

prefix + boost

The identifier also has a prefix match with a 200 boost, so if a user searches for, say Y2002.19, it will display the result with an identifier Y2002.19, which is a collection, then any items within that collection, which have the identifier Y2002.19/***.

match_phrase

This query gives a score boost to documents that have multiple words in the query within close proximity of each other. The limit on the number of words difference is indicated with the slop value.

filter

exists

If this field exists, multiply the document's score by the weight value.

term

If this field matches, multiply the document's score by the weight value.

We are using this to reduce the score of categories we think are less likely to be searched, when other results are available, for example, documents of model trains will score lower than documents of the actual train.

min_score

This is the minimum score a document needs to have to show in the search results. We can use this to reduce the number of mostly irrelevant results being returned.