How to query for many facets in single elasticsearch query -


i'm looking way query distribution of top n values many object fields in single query

my object in elastic search looks like:

obj: {   os: "android",   device_model: "samsung galaxy s ii (gt-i9100)",   device_brand: "samsung",   os_version: "android-2.3",   country: "br",   interests: [1,2,3],   behavioral_segment: ["sport", "lifestyle"]  } 

the following query brings distribution of values specific field number of appearances of value uk users

  curl -xpost http://<endpoint>/profiles/_search?search_type=count -d ' {   "query": {       "match": {         "country" : "uk"       }  },  "facets": {     "itemspercategorycount": {       "terms": {           "field": "behavioral_segment"       }   }   } }' 

how can query many fields - example result behavioral_segment , device_brand , os in single query. possible?

in facets section of query, should use fields parameter.

"facets": {   "itemspercategorycount": {     "terms": {       "fields": ["behavioral_segment","device_brand"]     }   } } 

that should solve problem, of course might not garantee coherence of data


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -