Custom Request Handler


(Eugene Strokin) #1

Hello, very often I have a case when I need to make 2 calls to ES for
a single search, one to get ID's of the documents which I realy need,
and the second call to actually get those documents.
The queries are fast, so I don't mind to make 2 calls, but I'm
thinking about HTTP overhead.
In Solr, I had Custom Request Handler for such cases. I was getting a
request on Solr side, ran first query, and right from the Request
Handler ran the second query right off, without sending response of
the first request back. And the result of the second query was the
actual response to the client.
I wander if this is possible to do on ES? And if it is, could you
point me to some documentation and/or example of how to do this?
Also, any suggestion about the subject is appreciated.
Thank you,
Eugene S.


(Shay Banon) #2

If you want to expose a new HTTP / REST endpoint, you can write a plugin that registers a custom REST endpoint, and use the Client API to issue the relevant requests and return a response. If its on the Java API level, you can create your own API extension (much nicer in upcoming 0.19).

On Monday, February 6, 2012 at 5:55 PM, Eugene Strokin wrote:

Hello, very often I have a case when I need to make 2 calls to ES for
a single search, one to get ID's of the documents which I realy need,
and the second call to actually get those documents.
The queries are fast, so I don't mind to make 2 calls, but I'm
thinking about HTTP overhead.
In Solr, I had Custom Request Handler for such cases. I was getting a
request on Solr side, ran first query, and right from the Request
Handler ran the second query right off, without sending response of
the first request back. And the result of the second query was the
actual response to the client.
I wander if this is possible to do on ES? And if it is, could you
point me to some documentation and/or example of how to do this?
Also, any suggestion about the subject is appreciated.
Thank you,
Eugene S.


(system) #3