Elasticsearch exception [type=illegal_argument_exception, reason=Can't load fielddata on [brandName] because fielddata is unsupported on fields of type [keyword]. Use doc values instead.]

报错mappings:

PUT wusong_product
{"mappings": {"properties": {"skuId": {"type": "long"},"spuId": {"type": "keyword"},"skuTitle": {"type": "text","analyzer": "ik_smart"},"skuPrice": {"type": "keyword"},"skuImg": {"type": "keyword","index": false,"doc_values": false},"saleCount": {"type": "long"},"hasStock": {"type": "boolean"},"hotScore": {"type": "long"},"brandId": {"type": "long"},"catalogId": {"type": "long"},"brandName": {"type": "keyword","index": false,"doc_values": false},"brandImg": {"type": "keyword","index": false,"doc_values": false},"catalogName": {"type": "keyword","index": false,"doc_values": false},"attrs": {"type": "nested","properties": {"attrId": {"type": "long"},"attrName": {"type": "keyword","index": false,"doc_values": false},"attrValue": {"type": "keyword"}}}}}
}

修改后的mappings:

PUT wusong_product
{
  "mappings": {
    "properties": {
      "skuId": {
        "type": "long"
      },
      "spuId": {
        "type": "keyword"
      },
      "skuTitle": {
        "type": "text",
        "analyzer": "ik_smart"
      },
      "skuPrice": {
        "type": "keyword"
      },
      "skuImg": {
        "type": "keyword"
      },
      "saleCount": {
        "type": "long"
      },
      "hasStock": {
        "type": "boolean"
      },
      "hotScore": {
        "type": "long"
      },
      "brandId": {
        "type": "long"
      },
      "catalogId": {
        "type": "long"
      },
      "brandName": {
        "type": "keyword"
      },
      "brandImg": {
        "type": "keyword"
      },
      "catalogName": {
        "type": "keyword"
      },
      "attrs": {
        "type": "nested",
        "properties": {
          "attrId": {
            "type": "long"
          },
          "attrName": {
            "type": "keyword"
          },
          "attrValue": {
            "type": "keyword"
          }
        }
      }
    }
  }
}

原因:

出现该错误是因为ES5.x之后,对聚合所依据的字段用单独的数据结构(fielddata)缓存到内存里了,但是在text字段上默认是禁用的,如果有需要单独开启,这样做的目的是为了节省内存空间

解决es查询异常:lasticsearch exception [type=illegal_argument_exception, reason=Can‘t load fielddata on....相关推荐

  1. 解决Elasticsearch报错:exception [type=search_phase_execution_exception, reason=all shards failed]

    关于exception [type=search_phase_execution_exception, reason=all shards failed]这个es错误我是如何解决的! 由于服务器性能不 ...

  2. java使用ElasticSearch的scroll查询,高效的解决es查询数量的限制。

    java使用ElasticSearch的scroll查询,高效的解决es查询数量的限制. 一.为什么要使用ES的scroll (1)首先我们要明白es的查询机制:ES的搜索是分2个阶段进行的,即Que ...

  3. ElasticsearchStatusException[Elasticsearch exception [type=illegal_argument_exception, reason=Unknow

    这种多半是配置或者插件不对 ElasticsearchStatusException[Elasticsearch exception [type=illegal_argument_exception, ...

  4. ES时间查询报错 - “caused_by“:{“type“:“illegal_argument_exception“,“reason“:“failed to parse date field

    项目场景: 在ES的使用过程中,用到了时间范围的查询功能,出现时间解析错误的报错信息:"caused_by":{"type":"illegal_arg ...

  5. ES使用聚合查询报错exception [type=search_phase_execution_exception, reason=all shards failed]

    首先看聚合查询写的代码 聚合查询 使用的是tags这个字段分组查询,使用term查询. term查询的话必须查询的字段是keyword类型,而且在java代码后面需要加入.keyword. text是 ...

  6. ES聚合查询报 can‘t load fielddata on because fielddata is unsupported on fields of type x,use doc value..

    在es5.6版本的时候,使用聚合语句查询es的时候,会出现异常,关键信息如下: can't load fielddata on because fielddata is unsupported on ...

  7. es查询-统计总数以及深度分页

    一.查询总数 1.  ES 查询 hits 统计总数不准? 当我们使用 ES 的时候,有时会比较关心匹配到的文档总数是多少,所以在查询得到结果后会使用 hits.total.value 这个值作为匹配 ...

  8. ES 查询时提示:all shards failed [type=search_phase_execution_exception]

    我的情况和解决方案 这种错误大概率是 ES 的查询语句语法错误,比如我当时是,时间筛选的条件的格式写错了,导致 ES 查询时解析错误,从而报了all shards failed [type=searc ...

  9. ES 查询时报错 I/O 异常: Request cannot be executed; I/O reactor status: STOPPED

    问题: ES 查询时报错 I/O 异常: java.lang.IllegalStateException: Request cannot be executed; I/O reactor status ...

最新文章

  1. 大巧不工-WEB前端设计修炼之道pdf
  2. 一看就懂,图解 Spring 循环依赖,写得老好了!
  3. MATLAB 人脸定位
  4. 网络协议之:还在用HTTP代理?过时了,快试试SOCKS5
  5. 【牛客 - 370H】Rinne Loves Dynamic Graph(分层图最短路)
  6. 【CSU - 1023】【HRBUST - 1039】修路(二分,枚举)
  7. 区别不同浏览器,CSS hack写法
  8. 体育赛事中的概率计算问题
  9. 安装 SQL Server Compact Edition 及 与PC 数据同步的部署
  10. java wed 1
  11. 数学竞赛辅导陈启浩pdf_【优秀论文】第九届MathorCup高校数学建模挑战赛(B题)...
  12. 查看 win 系统开机关机,启动时间
  13. 老将引退AMD换血成功
  14. 攻防世界misc——misc1
  15. 贪心算法(Greedy)
  16. iOS开发中解决Compiling IB documents for earlier than ios 7 is no longer supported的问题
  17. Windows系统下电脑强制卡死、关机的邪恶方法
  18. python爬取简历模板_python 爬取免费简历模板网站的示例
  19. 前端必备 PS三种切图方法 Cutterman最好用的切图工具
  20. 用java做个新手引导功能,Unity3D新手引导开发手记

热门文章

  1. ACK和Ack的区别
  2. OAuth2实现单点登录SSO
  3. 多线程面试题(高薪高频)
  4. YTU OJ 2451: 股市风云
  5. PhpStorm中实现代码自动换行
  6. 编程萌新必看!初学C语言必会的知识点,你学废了吗?
  7. phpinfo函数的使用
  8. java 粒度_java中粗粒度和细粒度的概念
  9. FrameGraph Extensible Rendering Architecture in Frostbite
  10. MATLAB——Z变换与Z反变换