I have to query several completion suggesters at the same time. This is easy to do using the _suggest api.
However if I want to query multiple suggesters on different indexes I have two choices: 1. Perform multiple http requests using the _suggest api 2. Use the _msearch api. I am currently using option 1 which appears to perform reasonably well so far however I would like to only perform a single request if possible so I have been playing with the _msearch api. The problem is when performin a single _msearch request for multiple suggesters on multiple indexes, each index also ends up getting queried, return all the hits as though I had also queried with matchall : {} In order to minimize this issue I have set the size parameter to 0 which prevents the hits from being returned. However I still get a total count returned for all the documents in each index. This implies to me that Elasticsearch is still doing some unnecessary work matching and counting documents in each index when all I really want returned are the suggestions. - Is Elasticsearch actually performing any work other than for the suggesters? - If so is there another way to return suggestion from multiple completion suggesters across several indices in a single request without querying at all? - Would using _msearch in this manner be considered a better practice than performing two or more _suggest calls in parallel? My request currently looks like this: var request = [{ index: 'users', type: 'user' }, { size : 0, suggest: { users_suggest: { text: term, completion: { size : 5, field: 'users_suggest' } } } }, { index: 'photos', type: 'photo' }, { size : 0, suggest : { tags_suggest: { text: term, completion: { size : 3, field: 'tags_suggest' } }, place_suggest: { text: term, completion: { size : 3, field: 'place_suggest' } }, country_suggest: { text: term, completion: { size : 3, field: 'country_suggest' } } } }]; And the results I am getting returned are as follows : [{ "took": 8, "timed_out": false, "_shards": { "total": 5, "successful": 5, "failed": 0 }, "hits": { "total": 28, "max_score": 0, "hits": [] }, "suggest": { "users_suggest": [{ "text": "t", "offset": 0, "length": 1, "options": [***suggestions***] }] } }, { "took": 8, "timed_out": false, "_shards": { "total": 5, "successful": 5, "failed": 0 }, "hits": { "total": 117, "max_score": 0, "hits": [] }, "suggest": { "country_suggest": [{ "text": "t", "offset": 0, "length": 1, "options": [] }], "place_suggest": [***suggestions***] }], "tags_suggest": [***suggestions***] }] } }] -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/21f8e109-5741-4ba0-84de-1c41759dea6a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.