我已经从elasticsearch网站下载了一个示例帐户json数据库。 https://www.elastic.co/guide/en/elasticsearch/reference/current/_exploring_your_data.html
我正在尝试在其上进行一些查询。
例如,
curl -XGET 'http://localhost:9200/bank/account/_count?pretty' -d '{
"query":{
"filtered":{
"filter":{
"bool":{
"should":[{"term":{"gender":"M"}},{"term":{"age":35}}]
}
}
}
}
}'
得到正确的计数输出。
但是,如果我尝试使用以下查询,则不会得到正确的结果。
curl -XGET 'http://localhost:9200/bank/account/_count?pretty' -d '{
"query":{
"filtered":{
"filter":{
"bool":{
"should":[{"term":{"gender":"F"}},{"term":{"state":"PA"}}]
}
}
}
}
}'
我没有得到正确的结果。查询语法或使用方式有什么问题吗?
任何人都可以在这里帮忙!
最佳答案
搜索时使用小写字母
eg- f not F
pa not PA
阅读此书可更好地了解ElasticSearch not returning results for terms query against string property
关于elasticsearch - 在Elasticsearch中使用术语查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39592634/