How to obtain document fields during query rewrite

I'd like to create a plugin with a custom Query that looks something like

{ my_query: { id: "52952683291b6d43120de872" } }

And in the rewrite method, I'd like to use values from that document. For
example, if the document looks like:

{ _id: "52952683291b6d43120de872", foo: 23, bar: 103 }

Then I may want to rewrite my_query as:

{ numeric_range: { foobar: { gte: 23, lte: 103 } } }

In my rewrite method implementation, how do I obtain the reference document?


You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
For more options, visit