Get every Nth result in Elasticsearch -


i have large set of data , want sample can use in graph. don't need of data, need every nth item.

for instance if have 4000 results, , need 800 results, want able every 5th result.

so like: get, skip, skip, skip, skip, get, skip, skip, skip,..

i wondering if such thing possible in elasticsearch?

you're better off using scripted filter. otherwise you're needlessly using score. filters queries, don't use scoring.

post /test_index/_search {   "query": {     "filtered": {       "filter": {         "script": {           "script": "doc['unique_counter'].value % n == 0",           "params" : {             "n" : 5           }         }       }     }   } } 

you're better off not using dynamic scripting in real world usage.

that said, want take @ aggregations graphing analytical information data rather taking arbitrary sample.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -