Getting documents that have a field value within a certain range of that of a particular document, in just one query, given only the document's id?

The title is pretty self explanatory!

I have many documents in an index. Each document has a field X. Given an id i of a document, Is there a way to get the X value of i and return all the documents whose X value is within a certain range, all in one query?

My problem is basically referencing The X value of document i within my range query.


No, that sounds like a join, which Elasticsearch does not support. You will probably need to do that using two separate queries.

1 Like

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