How to obtain document fields during query rewrite

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

{ 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?

Thanks,
Ricky

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/5f5b25fb-64f6-49a0-978d-b61b93f9c4e0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.