0
votes

I am trying to use elasticsearch to filter millions of data. All data are in one index and I want to access them in a 'direct' way.

What I mean with direct way? Direct way means for example accessing the 700000th element of this index (not by id). Is this possible somehow?

What I tried already:

  • from + size works, but seems not to be fast if number of elements > 10000
  • Scrolling I didn't try, but it's seem somehow not the right thing for my use-case.

So any other ideas?

1
And what is your use-case that you need to access exactly 700000th element of the index? In most of cases (when you want to retrieve everything) scrolling is the best option.JiriS
My use-case is quite simple. I have a table that represents all elements of my index. Thus I cannot load all elements in the memory, I want to load the elements lazy. The table is telling my only which element is needed and then I want to fetch the element from elasticsearch.rage

1 Answers

0
votes

Scrolling will not work. That will fetch all the data.

I think elasticseach is not the correct use case for what you want to do.

It would be better to use a linked list of the ids, that will let you fetch the id by index and then you can query elasticsearch to get the data.

If you data is such that it does not get modified or deleted then you can add an extra field in the mapping that will act like an auto increment field in a database. You can fetch the data using that field.