From json string to SearchResponse object


(Aykut Uysal) #1

Hello all,

I'm querying elasticsearch through its rest interface and getting a
json result. I wonder if there is a common way to map returning json
string into SearchResponse object which is available in Java API.

I've found SearchResponse.readFromResponse() and readFrom() methods.
So far I couldn't make them work and while doing some research I've
also found kimchy saying 'There is no way to parse a json to a
SearchResponse' in this thread :
http://elasticsearch-users.115913.n3.nabble.com/From-JSON-to-Java-API-and-back-td2655285.html

Can someone clarify this issue for me?

Thank you
aykut


(David Pilato) #2

I don't understand.
Why don't you use Search Java API directly ?

David :wink:
Twitter : @dadoonet / @elasticsearchfr

Le 31 juil. 2012 à 12:47, Aykut Uysal aykutuysal@gmail.com a écrit :

Hello all,

I'm querying elasticsearch through its rest interface and getting a
json result. I wonder if there is a common way to map returning json
string into SearchResponse object which is available in Java API.

I've found SearchResponse.readFromResponse() and readFrom() methods.
So far I couldn't make them work and while doing some research I've
also found kimchy saying 'There is no way to parse a json to a
SearchResponse' in this thread :
http://elasticsearch-users.115913.n3.nabble.com/From-JSON-to-Java-API-and-back-td2655285.html

Can someone clarify this issue for me?

Thank you
aykut


(Aykut Uysal) #3

Decision of using REST is made a little time ago. It's part of a large
project and I'm doing some research about mapping options. I just
wondered if there is a way to use Java API domain objects like
SearchResponse for mapping the response json since it already has the
structure that we need.

On Tue, Jul 31, 2012 at 3:29 PM, David Pilato david@pilato.fr wrote:

I don't understand.
Why don't you use Search Java API directly ?

David :wink:
Twitter : @dadoonet / @elasticsearchfr

Le 31 juil. 2012 à 12:47, Aykut Uysal aykutuysal@gmail.com a écrit :

Hello all,

I'm querying elasticsearch through its rest interface and getting a
json result. I wonder if there is a common way to map returning json
string into SearchResponse object which is available in Java API.

I've found SearchResponse.readFromResponse() and readFrom() methods.
So far I couldn't make them work and while doing some research I've
also found kimchy saying 'There is no way to parse a json to a
SearchResponse' in this thread :
http://elasticsearch-users.115913.n3.nabble.com/From-JSON-to-Java-API-and-back-td2655285.html

Can someone clarify this issue for me?

Thank you
aykut


(ferhatsb) #4

Hi Aykut,

We are working on a rest client based on Java. It has it's own API and also
it has a bridge that can be plugged to native Java API, so you can use it
as is over a rest endpoint.

BUT it is not ready for production though give us some weeks it will be
alpha :slight_smile:

Checkout source code you will find some tricks about your question.

KR,

Ferhat
www.searchbox.io

On Tuesday, July 31, 2012 4:09:24 PM UTC+3, Aykut Uysal wrote:

Decision of using REST is made a little time ago. It's part of a large
project and I'm doing some research about mapping options. I just
wondered if there is a way to use Java API domain objects like
SearchResponse for mapping the response json since it already has the
structure that we need.

On Tue, Jul 31, 2012 at 3:29 PM, David Pilato <da...@pilato.fr<javascript:>>
wrote:

I don't understand.
Why don't you use Search Java API directly ?

David :wink:
Twitter : @dadoonet / @elasticsearchfr

Le 31 juil. 2012 à 12:47, Aykut Uysal <aykut...@gmail.com <javascript:>>
a écrit :

Hello all,

I'm querying elasticsearch through its rest interface and getting a
json result. I wonder if there is a common way to map returning json
string into SearchResponse object which is available in Java API.

I've found SearchResponse.readFromResponse() and readFrom() methods.
So far I couldn't make them work and while doing some research I've
also found kimchy saying 'There is no way to parse a json to a
SearchResponse' in this thread :

http://elasticsearch-users.115913.n3.nabble.com/From-JSON-to-Java-API-and-back-td2655285.html

Can someone clarify this issue for me?

Thank you
aykut

--


(system) #5