Elasticsearch return raw json with java api -


i have following requirements in spring web app:

  • find objects elasticsearch , display them on google map (json format preferred)
  • find objects (the same query above) elasticsearch , display them on list (java objects format preferred display on jsp page)

i've written search java api using searchrequestbuilder , works fine:

searchrequestbuilder request = client.preparesearch("index").settypes("type")         .setsearchtype(searchtype.query_then_fetch).setfrom(0).setsize(10).addfields(response_fields); //request more complicated //... searchresponse response = request.execute().actionget(); searchhits hits = response.gethits(); 

but displaying on google map prefer json object elasticsearch instead of searchresponse object this:

{     "_index": "indexname",     "_type": "type",     "_id": "9094",     "_version": 31,     "found": true,     "_source": {         //list of properties     } } 

is possible json response using java api + searchrequestbuilder or have use rest api that?

the java api not map json (or other entity matter) you. however, like:


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -