2016-11-22 5 views

答えて

1

他のフィールドと同様に検索できます。

-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" ] 
     } 
    } ] 
    } 
} 
+0

と私がしたい場合は、すべてのジョーンズとアニーさん:

は、私はこのようなboolクエリを使用して終了しましたか? – awavi

+0

OR節 'q =乗客:John OR passengers:Annie'を追加するだけです –

0

codegrep_adminの回答は機能しますが、私は簡単に操作できるものを探していました。

[GET] /my_index/cars/_search 

{ 
    "query": { 
    "bool": { 
     "must": [ 
      { "match": { "passengers": "John" }}, 
      { "match": { "passengers": "Annie" }} 
     ] 
    } 
} 
関連する問題