i have indexed data based on field "a". there 18 values associated same value of "a". therefore, while indexing, elasticsearch has assigned same value of "a" 18 records has assigned specific version each record.
eg: record 1 : a=1, _version=1, record 2 : a=1, _version=2, record 3 : a=1, _version=3 , on.
the question is, how retrieve these records belonging 1 single value of "a" using java? (boolquery, termsquery, scroll, multimatchquery not being useful in case. hence doubt.)
you can aggregation query search documents , aggregate them using distinct aggregation on field (a). give possible values of a. query document matches on specific field value can term filter search path.