How to implement completion prefix suggestion per aliases in elasticsearch

327 views Asked by At

I cannot make complete suggester as described here:

https://github.com/elasticsearch/elasticsearch/issues/3376

to work for aliases. Always get global index answers.

Can I filter suggestions for aliases in any way?

2

There are 2 answers

1
Ahuman On BEST ANSWER

You know suggester is an experimental feature with quite a few limitations. I followed this article http://blog.qbox.io/multi-field-partial-word-autocomplete-in-elasticsearch-using-ngrams.

0
rad1x On

I did it using that field definition in mapping:

"suggester": {                
   "type": "completion",     
   "context": {              
       "alias_name": {             
       "type": "category"
   }                     
}    

And this is record structure:

record = {                                      
 'input': input_text,                      
 'output': output_text, 
 'context': {                                
     'alias_name': alias_name                        
 },                                          
 'weight': weight                            
}                
           `                        

.. but it seems like routing does not work (query hits all shards)