I have indexed a document like this:
[PUT] /my_index/cars/1
{
"color" : "red",
"passengers" : ["John", "Annie", "William"]
}
I am trying to search all the cars where "John" is a passenger.
You can search just like any other field.
-bash-4.2$ curl 'localhost:9200/my_index/_search?pretty=true&q=passengers:John'
{
"took" : 4,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.15342641,
"hits" : [ {
"_index" : "my_index",
"_type" : "cars",
"_id" : "1",
"_score" : 0.15342641,
"_source" : {
"color" : "red",
"passengers" : [ "John", "Annie", "William" ]
}
} ]
}
}
q=passengers:John OR passengers:Annie