2017-08-29 28 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