Scroll vs mget when searching by ids on alias (edit - mget doesn't work on alias)


#1

In a use case I am working on I need to search by ID's on an alias that has about 100 indices. I randomly picked about 30 ID's and ran both mget and scroll by ids and I get inconsistent timings out of each, which is confusing and not sure which is better solution for use case like this ?

Run mget scroll
1 108.213038ms 237.588876ms
2 256.001204ms 161.914637ms
3 202.533423ms 107.588615ms
4 211.439077ms 114.235954ms

Any suggestions or details how each of these gets executed under hood when doing it via alias ?

Thanks

Edit: Just realized that mget doens't work on alias at all, thought it was working because top level query doesn't return error, but individual queries does :frowning:


(Xavier Facq) #2

Hi,

Why do you need to scroll if you pick only 30 ids ? Do you run an IdsQuery with all your IDs in and a from=0 and size = 30 ?

bye,
Xavier


#3

I scroll with ID's query by providing specific ID's I am looking for, as this is on a alias, I can't really do a GET for ID's.

I guess in that case I can just stick to ID's query as search instead of scroll


(Xavier Facq) #4

How many IDs are in your query ? I'm not certain to understand your problem.

To my mind, if you run an Ids Query, there is no reason to scroll. If you pass 1000 ids, set size to 1000, if there is more than 1024, run a multirequest, or loop over your array?

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-ids-query.html


#5

Agreed. I misunderstood few things when I posted the question. Appreciate your response. Thanks


(system) #6

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.