elasticsearch - OrchardCore match_phrase不返回结果

标签 elasticsearch orchardcms

我有以下查询

{
  "from": 0, "size": 10000,
  "query": { "match_phrase": {"Practitioner.DoctorList": "peter goh"} },
}
它不会返回任何结果。
但以下内容:
{
  "from": 0, "size": 10000,
  "query": { "match": {"Practitioner.DoctorList": "peter goh"} },
}
返回具有“peter goh”,“peter”和“goh”的内容。match_phrase为什么不返回任何内容?因为我只希望结果与“peth goh”匹配。

最佳答案

由于尚未添加任何样本数据和索引映射,(考虑到Practitionernested类型)
引用match_phrase查询,以获取详细信息
添加带有索引数据,映射和搜索查询的工作示例。
索引映射:

{
  "mappings": {
    "properties": {
      "Practitioner": {
        "type": "nested" 
      }
    }
  }
}
索引数据:
{
    "Practitioner": [
        {
            "DoctorList": "goh"
        },
        {
            "DoctorList": "peter goh"
        },
        {
            "DoctorList": "peter"
        }
    ]
}
搜索查询:
    {
  "query": {
    "nested": {
      "path": "Practitioner",
      "query": {
        "match_phrase": {
          "Practitioner.DoctorList": "peter goh"
        }
      },
      "inner_hits":{}
    }
  }
}
搜索结果:
"hits": [
                {
                  "_index": "fd_cb3",
                  "_type": "_doc",
                  "_id": "1",
                  "_nested": {
                    "field": "Practitioner",
                    "offset": 1
                  },
                  "_score": 0.78038335,
                  "_source": {
                    "DoctorList": "peter goh"
                  }
                }
              ]

关于elasticsearch - OrchardCore match_phrase不返回结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63521507/

相关文章:

orchardcms - 在 Orchard 中自定义呈现列表时如何访问项目部件

c# - 如何使用 Orchard CMS 创建推荐页面?

c# - 验证管理仪表板 Orchard CMS 中的页面标题

permissions - Orchard CMS 需要什么权限?

orchardcms - 自定义管理主题未加载

ruby - ruby 代码Logstash中的功能

elasticsearch - 包含/的elasticsearch查询字符串

json - 搜索使用json文件创建的 Elasticsearch 索引

database - 当数据模型不固定时,如何编制索引?

elasticsearch - 根据数组计数过滤弹性数据