I am trying to run several aggregates at the same level as ElasticSearch using elasticsearch rails and elasticsearch model reliefs.
In the hash of the request that I generate, I have the following -
def query_hash(params, current_person = nil, manager_id = nil)
aggs = {}
aggs[:home_country_id] = {terms: {field: "home_country_id"}}
aggs[:home_region_id] = {terms: {field: "home_region_id"}}
{
sort: [ { created_at: { order: "desc" } }, id: { order: "desc" } ],
aggs: aggs
}
end
The answer I saved in the es_response object.
When I search for both units, I can only find the last answer.
es_response.response [ "aggregrations"] has only response last object aggregation home_region_id.
I could not find much ES Reference documentation for structuring multiple aggregates at the same level, although there was a lot about nesting aggregation.
How can i fix this?
My ES version is 5.1