【发布时间】:2015-07-29 09:35:25
【问题描述】:
我遇到了搜索错误 - 需要一些帮助。我有带有 id、标题、艺术家、流派字段的文章索引。当我运行此查询时,我得到零结果-
POST /d3acampaign/article/_search
{
"query": {
"filtered": {
"query": {
"match": {"genre": "metal"}
},
"filter": {
"term": {"artist": "Somanath"}
}
}
}
}
但是,如果我将查询更改为 - POST /d3acampaign/article/_search
{
"query": {
"filtered": {
"query": {
"match": {"genre": "metal"}
},
"filter": {
"term": {"id": "7"}
}
}
}
}
我得到以下结果 -
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1.4054651,
"hits": [
{
"_index": "d3acampaign",
"_type": "article",
"_id": "7",
"_score": 1.4054651,
"_source": {
"id": "7",
"title": "The Last Airbender",
"artist": "Somanath",
"genre": "metal"
}
}
]
}
}
澄清 - 我注意到如果我尝试使用字符串,例如搜索失败。艺术家,标题
【问题讨论】:
标签: elasticsearch term