2017-08-29 43 views
0

我的elasticsearch版本是2.4,常見術語查詢不提取數據

我正在使用此查詢,但是這是給空白數組。 任何人都可以幫助我找到我錯在哪裏。

curl -XGET 'localhost:9200/stores/store/_search?pretty' -H 'Content-Type: application/json' -d' 
{ 
"query": { 
    "common": { 
    "body": { 
    "query": "donald trump for president", 
    "cutoff_frequency": 0.1 
    } 
    } 
    } 
}' 

OUTPUT:

"took" : 6, 
    "timed_out" : false, 
    "_shards" : { 
    "total" : 3, 
    "successful" : 3, 
    "failed" : 0 
    }, 
    "hits" : { 
    "total" : 0, 
    "max_score" : null, 
    "hits" : [ ] 
    } 
} 
+0

查詢看起來沒問題。你能否顯示你的映射,以及你期望通過這個查詢找到的示例文檔? – dshockley

+0

curl -XPUT'http:// localhost:9200/new_stopwords /'-d'{「settings」:{「index」:{「number_of_shards」:6,「number_of_replicas」:1}},「mappings」:{ new_stopword「:{」_all「:{」enabled「:true},」properties「:{」title「:{」type「:」text「,」boost「:2},」description「:{」type「 「text」}}}}}' – Ganesh

回答

1

它看起來像你查詢的字段不存在(body)。您應該查詢映射中存在的字段,或者_all

{ 
"query": { 
    "common": { 
    "_all": { 
    "query": "donald trump for president", 
    "cutoff_frequency": 0.1 
    } 
    } 
    } 
} 
+0

謝謝... @dshockley – Ganesh