我正在使用elasticsearch 2.1。我不太清楚自己做錯了什麼。它讓我對查詢,過濾器之間的差異感到困惑......你能幫助我嗎?ElasticSearch簡單搜索問題
我正試圖執行此查詢。它返回我空的結果:
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":[
]
}
]
恕我直言,它應該解決,而不是通過手動降低它,但添加小寫搜索分析儀。 – Mantas
'term'過濾器不分析任何東西。 'match'查詢可以用來代替,這也可以做到這一點。 – Val
謝謝!我試着用'term filter - >「feina」'和'match filter - >「FeINa」',並且它們正確地返回文檔。但是,如果我想要匹配「fein」,「fen」,「EIna」等詞......我該如何解決這個問題? – Jordi