Hi,
I have a query that gives me a result like this:

> {
>    "took": 3,
>    "timed_out": false,
>    "_shards": {
>       "total": 8,
>       "successful": 8,
>       "failed": 0
>    },
>    "hits": {
>       "total": 8,
>       "max_score": 0,
>       "hits": []
>    },
>    "aggregations": {
>       "hmicro": {
>          "buckets": [
>             {
>                "key_as_string": "2",
>                "key": 2,
>                "doc_count": 8
>             }
>          ]
>       },
>       "hmini": {
>          "buckets": [
>             {
>                "key_as_string": "0",
>                "key": 0,
>                "doc_count": 8
>             }
>          ]
>       },
>       "hmacro": {
>          "buckets": [
>             {
>                "key_as_string": "1",
>                "key": 1,
>                "doc_count": 8
>             }
>          ]
>       }
>    }
> }


I want to take the entire "aggregations" content and put in as document. So 
i get the aggregations object

        JSONObject query = getQuery("statesQuery");
>         SearchResponse sResponse = 
> remoteClient.prepareSearch(tribeIndex).setTypes("prc-i-state")
>             .setSource(query).execute().actionGet();
>
>         Aggregations aggs = sResponse.getAggregations();


and i should use this to create the document:

        client.prepareIndex(runIndex_write, "state-hist")
>             .setParent(runNumber)
>             .setSource(aggs)
>             .execute();   


But i dont know how to transform aggs in the right object for the setSource 
function.

Could you help me ? 

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/9418c080-9807-410a-acef-5449cf583bc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to