Customizing Similarity
You can customize the “more like this” query in several ways:
- Use minimum_should_match to require more or fewer matching terms
- Boost certain fields with “fields”: [“title^2”, “plot”]
- Use stop_words to ignore common stopwords
- Set max_doc_freq to ignore common terms across documents
- Use a filter to limit results by other criteria
The “more like this” query provides a powerful semantic relevance capability built into Elasticsearch’s core functionality. It opens up many interesting use cases around recommendations, related content, semantic search, and more.
Similarity Queries in Elasticsearch
Elasticsearch, a fast open-source search and analytics, employs a “more like this” query. This query helps identify relevant documents based on the topics and concepts, or even close text match of the input document or set of documents.
The more like this query is useful especially when coming up with a set of results or a list of recommendations when you get some results closely associated with other contents. This can be useful when a particular query requires identifying semantic relations that do not necessarily relate to the keywords used for the search.