ES数据库查询报错 field:[10400001] was indexed without position data; cannot run PhraseQuery“

1.问题描述:

es组合查询时报错

报错信息:

{
  "error": {
    "root_cause": [
      {
        "type": "query_shard_exception",
        "reason": "failed to create query: field:[10400001] was indexed without position data; cannot run PhraseQuery",
        "index_uuid": "tfDFEQKCTVmDlAUK1wuO3A",
        "index": "zkcx_ebookcollection_1987055001"
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "zkcx_ebookcollection_1987055001",
        "node": "DTKIgGfRR-elySpyq6i9PQ",
        "reason": {
          "type": "query_shard_exception",
          "reason": "failed to create query: field:[10400001] was indexed without position data; cannot run PhraseQuery",
          "index_uuid": "tfDFEQKCTVmDlAUK1wuO3A",
          "index": "zkcx_ebookcollection_1987055001",
          "caused_by": {
            "type": "illegal_state_exception",
            "reason": "field:[10400001] was indexed without position data; cannot run PhraseQuery"
          }
        }
      }
    ]
  },
  "status": 400
}

2.分析原因:

“reason”: “failed to create query: field:[10400001] was indexed without position data; cannot run PhraseQuery”,
网上查询相关信息后找到了问题的关键:
查询时,不能解析address,组合查询,字段的类型必须是text类型,keyword会报异常

3.问题解决

(1)查询映射信息
使用Postman,向ES服务器发送GET请求:
http://192.168.0.228:12000/zkcx_datacenter_do_1987055001/_mapping/

在这里插入图片描述

(2)修改字段映射类型为text(这一步我没有测试,领导说他来弄)
修改映射信息,Elasticsearch 不支持修改,需要删除后重新添加
使用Postman,向ES服务器发送PUT请求:http://192.168.0.228:12000/zkcx_datacenter_do_1987055001/_mapping/
参数:[Body] → [raw] → [JSON]

原文链接:https://blog.csdn.net/xzlawin/article/details/121855761

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

徐州蔡徐坤

又要到饭了兄弟们

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值