Es 7.x版本批量写入数据路由字段报错:Action/metadata line [1] contains an unknown parameter [_routing] 原创 2021-03-02 19:02 阅读(3590)次 #### 异常问题 在使用elasticsearch7版本批量插入数据时,因为设置了路由,一直报错:Action/metadata line [1] contains an unknown parameter [_routing] 具体错误信息如下: ```json {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Action/metadata line [1] contains an unknown parameter [_routing]"}],"type":"illegal_argument_exception","reason":"Action/metadata line [1] contains an unknown parameter [_routing]"},"status":400} ``` 批量写入的DSL语句如下: ```json PUT /_bulk {"index":{"_id":"1","_index":"bd_frequent_test","_routing":"1222930"}} {"ape_id":"949","appear_num":1,"create_time":"2019-12-28 00:46:08","event_time":"2019-12-28","id":1,"last_event_time":"2019-12-28 00:46:08","pid":"1222930","storage_date":"2019-12-28"} {"index":{"_id":"2","_index":"bd_frequent_test","_routing":"5031160"}} {"ape_id":"711","appear_num":1,"create_time":"2019-12-29 11:06:39","event_time":"2019-12-29","id":2,"last_event_time":"2019-12-29 11:06:39","pid":"5031160","storage_date":"2019-12-29"} {"index":{"_id":"3","_index":"bd_frequent_test","_routing":"3094889"}} {"ape_id":"350","appear_num":1,"create_time":"2019-12-28 19:21:07","event_time":"2019-12-28","id":3,"last_event_time":"2019-12-28 19:21:07","pid":"3094889","storage_date":"2019-12-28"} {"index":{"_id":"4","_index":"bd_frequent_test","_routing":"2974413"}} {"ape_id":"684","appear_num":1,"create_time":"2019-12-29 22:36:06","event_time":"2019-12-29","id":4,"last_event_time":"2019-12-29 22:36:06","pid":"2974413","storage_date":"2019-12-29"} {"index":{"_id":"5","_index":"bd_frequent_test","_routing":"5819906"}} {"ape_id":"97","appear_num":1,"create_time":"2019-12-29 04:27:55","event_time":"2019-12-29","id":5,"last_event_time":"2019-12-29 04:27:55","pid":"5819906","storage_date":"2019-12-29"} {"index":{"_id":"6","_index":"bd_frequent_test","_routing":"6812661"}} ``` 这个语句之前在es7之前的版本,也就是es6.x版本时是可以批量写入的,但在7就报错了。 #### 解决办法 原来问题出在7的批量写入时,路由字段改成了routing,没有下划线。 将批量写入语句如下,就可以了: ```json PUT /_bulk {"index":{"_id":"1","_index":"bd_frequent_test","routing":"1222930"}} {"ape_id":"949","appear_num":1,"create_time":"2019-12-28 00:46:08","event_time":"2019-12-28","id":1,"last_event_time":"2019-12-28 00:46:08","pid":"1222930","storage_date":"2019-12-28"} {"index":{"_id":"2","_index":"bd_frequent_test","routing":"5031160"}} {"ape_id":"711","appear_num":1,"create_time":"2019-12-29 11:06:39","event_time":"2019-12-29","id":2,"last_event_time":"2019-12-29 11:06:39","pid":"5031160","storage_date":"2019-12-29"} {"index":{"_id":"3","_index":"bd_frequent_test","routing":"3094889"}} {"ape_id":"350","appear_num":1,"create_time":"2019-12-28 19:21:07","event_time":"2019-12-28","id":3,"last_event_time":"2019-12-28 19:21:07","pid":"3094889","storage_date":"2019-12-28"} {"index":{"_id":"4","_index":"bd_frequent_test","routing":"2974413"}} {"ape_id":"684","appear_num":1,"create_time":"2019-12-29 22:36:06","event_time":"2019-12-29","id":4,"last_event_time":"2019-12-29 22:36:06","pid":"2974413","storage_date":"2019-12-29"} ``` elasticsearch 异常处理 上一篇:Es创建索引mapping时报错:Root mapping definition has unsupported parameters: [doc 下一篇:es7.x版本如何获取查询命中的文档总数
相关文章 Es创建索引mapping时报错:Root mapping definition has unsupported parameters: [doc(8447) elasticsearch7.1保存时报错: Validation Failed: 1: type is missing;(10515) java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener(1195) solr搜索报错:Error from server at http://127.0.0.1:8983/solr/索引名: undefined field text(5187) 记一次maven报错解决:Failed to read artifact descriptor for com.aliyun.openservices:aliyun-openservices:jar:2.0.0-OTS(5641) windows nginx启动报错bind() to 0.0.0.0:80 failed (1949) Got error: 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) when trying to connect(2657) feign报错java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0(4010) feign报错:cannot retry due to redirection, in streaming mode(12282) seata并发测试报错:get global lock fail, xid:192.168.64.1:18091:2025291279, lockKeys:stock_info:1(7540) 推荐文章 elasticsearch7.1保存时报错: Validation Failed: 1: type is missing;(10515) 聊聊数据保存到MySQL后数据乱码的问题(1611) solr时区设置解决时间多8小时问题(2854) linux下MySQL5.7.18安装过程(1865) linux下MySQL5.6.2安装过程(1712) spring cloud+feign+mybatis中使用seata0.9实现分布式事务(6614) spring cloud gateway报错Only one connection receive subscriber allowed(4973) spring cloud中Feign调用诡异报错MethodNotAllowed: status 405 reading(8440) 使用spring4实现websocket连接(2683) jquery对象与dom对象互转(1509) 热门文章 clickhouse如何删除数据(39027) clickhouse清空删除表数据(17623) redis报错远程主机强迫关闭了一个现有的连接以及超时问题(15630) clickhouse执行查询内存超出限制问题:Memory limit (total) exceeded(13859) elasticsearch7.1保存时报错: Validation Failed: 1: type is missing;(10515) clickhouse如何修改字段名(9549) druid执行clickhouse报错:sql injection violation, dbType clickhouse , druid-version 1.2.2, syntax error(8568) Es创建索引mapping时报错:Root mapping definition has unsupported parameters: [doc(8446) Clickhouse批量删除分区(8075) postgresql生成uuid(7856) 标签列表 java java基础 微服务 异常处理 mysql spring boot spring cloud clickhouse elasticsearch linux feign jdbc js spring postgresql docker nginx seata gateway maven solr hsqldb canal dubbo 数据库 redis 大数据分析 分布式事务 架构 quartz rocketmq select2 win10 mybatis jenkins html springmvc hadoop git 消息队列 websocket xheditor 分布式 zookeeper 小程序 开发工具 数据库集群 电脑 笔记 设计模式 阿里云 activemq ajax bat eclipse freemarker gitlab hibernate http hystrix javamail jquery jvm redission redission对象 springmail svn ubuntu ueditor