ElasticSearch : Query multiple value in array -


I am trying to put the query / filter together for elastic search. Here is the structure that has the structure

  {_id: "0872300234", customers: [{name: "bob", priority: 1, type: "GoodUser"}, {name: "Dan" Priority: 10, type: "BadUser"}, {name: "sam", priority: 10, type: "good user"}, {name: "cam", priority: 2, type: "baduxer"}]} < / Code> 

then call it "profile" document / record. I would like to find all profiles that have a customer priority of 10 and it is a "good user" (the same customer), for example, Sam will match, but will not donate. I got a query that gives me a profile where a customer's priority is 10 and one customer (not the same) has a good user of type.

Is there a way to fully query an array object?

Thank you

You need nested type for this about nested objects You can find more information, and in those situations why do you need those reasons where the relationship between the nested fields is important in your case, the mapping needs to look like this:

  {"mappings ": {" Profile ": {" Properties ": {" Customer ": {" Type ":" Nested "," Properties ": {" Name ": {" Type ":" Str And "query"}, "priority": {"type": "integer"}, "type": {"type": "string"}}}}}}}  

Will be required to be nested, such as:

  {"query": {"nested": {"path" "customer", "query": {"bool": {"should" : [{"Match": {"customers.type": "goodUser"}}, {"word": {"customers.priority": {"value": 10}}}]}}}}}  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -