0

我正在尝试按特定字段过滤我的弹性搜索索引,确切地说是“国家”字段。但是,我不断收到大量不准确的其他结果(其他国家/地区)。

请有人指出我正确的方向。

我尝试了以下搜索:

GET http://127.0.0.1:9200/decision/council/_search
{
  "query": {
    "filtered": {
      "filter": {
        "term": {
          "country": "Algeria"
        }
      }
    }
  }
}

这是一个示例文档:

{
  "_index": "decision",
  "_id": "54290140ec882c6dac5ae9dd",
  "_score": 1,
  "_type": "council",
  "_source": {
    "document": "DEV DOCUMENT"
    "id": "54290140ec882c6dac5ae9dd",
    "date_updated": 1396448966,
    "pdf_file": null,
    "reported": true,
    "date_submitted": 1375894031,
    "doc_file": null,
    "country": "Algeria"
  }
}
4

1 回答 1

1

您可以改用 match_phrase 查询

POST http://127.0.0.1:9200/decision/council/_search
{
   "query" : {
      "match_phrase" : { "country" : "Algeria"}
            }
}
于 2014-09-29T20:17:13.233 回答