
( This post by Adam Wattis was very helpful in getting me started though).
COMPLETION SUGGESTER ELASTICSEARCH HOW TO
My problem is that I dont know how to use suggester context in nested fields. I need to somehow secure those suggestions so I figured out that simplest way to do so would be to add context to completion suggester. But couldn't find anything like that on SO/blogs/ES docs/elasticsearch-dsl docs after searching for quite sometime. Im working on simple search app with completion feature. I could come up something like that on my own (by breaking each phrase into words) but it seems counter-intuitive to do that on my own since I'd guess there would already be a default way that the user could further tweak if needed. For example: using each word in the phrase as a term. I was not able to find a working example on how to query Elasticsearch using the completion suggester in PHP (elasticsearch-php). But my question is how to do that with a ton of records? I was guessing there would be a standard way for ES to automatically come up with a few terms that could be used as suggestions.
COMPLETION SUGGESTER ELASTICSEARCH CODE
So I could just put a few terms in the name_suggest = statement above in my code which will match the corresponding field, when searched. In the previous articles, we look into Prefix Queries and Edge NGram Tokenizer to generate search-as-you-type suggestions. Name_suggest = <- # what goes in here?Īs per the ES docs, suggestions are indexed like any other field. The source is limited to the suggester field in order to make the response quicker. How to run Elasticsearch completion suggester query on limited set of documents. How do I increment the weight of a completion suggest field 1. Completion Suggester in ElasticSearch On Existing Field. Anupam you are right, but i looked at Elasticsearch. Elasticsearch completion suggester on multifield with different weighting. After upgrading to ES 5, I realized that the suggester is now document-oriented. But I want to avoid using regular search instead of completion suggester because as I understand completion suggester is designed for faster lookups (needed for search-as-you-type) Anupam. I relied on the autocomplete suggester in 2.3 to remove duplicate entries and provide unique suggestions of words/phrases. In the example above, we created the field suggest to contain the data to be searched. index boost works with match queries but not completion suggester, it seems. Here's my code: class SchoolIndex(DocType):īulk indexing as follows: def bulk_indexing():īulk(client=es, actions=(a.indexing() for a in ().iterator()))Īnd have defined an indexing method in models.py: def indexing(self): To create an autocomplete type suggester, you need to create a specific mapping with type completion. After trying to figure this out for a long time, I am not able to figure yet how to bulk index the suggester. I am trying to add a completion suggester to enable search-as-you-type for a search field in my Django app (using Elastic Search 5.2.x and elasticseach-dsl).
