ElasticSearch上的简单搜索麻烦
我正在使用Elasticsearch 2.1。我不太清楚自己在做什么错。它使我困惑查询,过滤器之间的区别…您能帮我吗?
我正在尝试执行此查询。它返回一个空结果:
curl -XGET 'http://ESNode01:9201/living_team/inputs/_search?pretty' -d '{
"query": {
"filtered": {
"query": { "match_all": {} },
"filter": { "term": { "channel": "Feina" } }
}
}
}
'
但是,当我执行不带过滤器的查询时,它将返回所有内容:
curl -XGET 'http://ESNode01:9201/living_team/inputs/_search?pretty' -d '{
"query": {
"filtered": {
"query": { "match_all": {} },
}
}
}
'
这是一个文档样本:
{ "user":"living_team",
"timestamp":"2015-12-14T18:06:47.085Z",
"matter":"snip2.PNG",
"comment":"Archive",
"channel":"Feina",
"feedTypes":[
20
],
"property_general_ldate":"2015-12-14T18:06:47.085Z",
"property_tSize":7595.0,
"resources":[
{
"timestamp":"2015-12-14T16:58:00.598Z",
"matter":"snip2.PNG",
"comment":"Archive",
"channel":"Feina",
"feedType":20,
"mime":"image/png",
"source":{
"sourceId":{
"id":"C:\\Users\\Beep\\Desktop\\share\\snip2.PNG",
"batch":"c38eec2d-a282-11e5-baf4-382c4ab9e433",
"client":"VIM12HCNZL"
},
"feedType":20,
"property_folder":"C:\\Users\\Beep\\Desktop\\share",
"property_lastAccessFolder_ldate":1450111821506
},
"property_size":7595.0,
"property_creation_ldate":"2015-12-14T16:50:20.578Z",
"property_name":"snip2.PNG",
"nestedResources":[
]
}
]
回答:
这应该工作。
curl - XGET 'http://ESNode01:9201/living_team/inputs/_search?pretty' - d ' {{
"query": {"match": {
"channel": "feina" }}
}'
以上是 ElasticSearch上的简单搜索麻烦 的全部内容, 来源链接: utcz.com/qa/407145.html