【问题标题】:using match query on a field在字段上使用匹配查询
【发布时间】:2017-03-02 22:25:20
【问题描述】:

使用查询字符串在索引中查询类型以匹配任何属性

{
    "size": 2,
     "_source":["awardeeName"],
    "query": {
        "query_string" : {
                "query": "health"
             }
    }
  }         
}

这会返回两条记录

[
{
    "_index": "docm-es",
    "_type": "document",
    "_id": "9d8c832d-f22f-463e-9102-4aefcaff88fa",
    "_score": 0.74211,
    "_source": {
        "awardeeName": "State of Hawaii Department of Health"
    }
},
{
    "_index": "docm-es",
    "_type": "document",
    "_id": "79963a60-8e9e-45ac-b7f8-6dc99f6b0621",
    "_score": 0.6427368,
    "_source": {
        "awardeeName": "New York State Department of Health"
    }
}
]

两个记录都显示,awardeename 属性包含单词 health。 查询以在字段 awardeeName 上搜索匹配的文本健康状况,

{
    "size": 2,
    "_source":["awardeeName"],
    "query": {
        "match" : {
                "awardeeName": "health"
             }
    }
  }         
}

这不返回任何命中,有什么问题,在这个查询中,请指教。

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    您能否通过添加您用于此字段的映射来更新问题

    【讨论】:

    • 我看到映射,awardeeName字段没有分析,我知道它应该被索引以进行全文搜索
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多