ElasticSearch ected map for property [fields] on field [subject_id] but got a class java.lang
ElasticSearch的聚类时出现fielddata=true
Expected map for property [fields] on field [subject_id] but got a class java.lang.String
错误代码:
data = {"properties":{"camera_position": "text",'fielddata': True}
}
正确代码:
data = {
"properties":{
"camera_position": {'type':"text",
'fielddata': True
}}
}
完整代码:
import json
import requestsheader = {'Content-Type': 'application/json'}def set_fielddata(index='event_tk'):try:data = {"properties":{"camera_position": {'type':"text",'fielddata': True}}}DNS_API = 'http://127.0.0.1:9200/' + index + '/_mapping/koala-index' # dns_test_v2为索引名# resp = requests.delete(DNS_API, headers=header)resp = requests.put(DNS_API, headers=header, data=json.dumps(data))print(resp.status_code)if resp.status_code == 200:print(u"set_fielddata ok")else:print(resp.text)except Exception as e:print(e, u"建立索引失败")def max_count(index='event_tk'):try:data={'index' : { "max_result_window" : 100000000}}DNS_API = 'http://192.168.1.152:9200/'+index+'/_settings' # dns_test_v2为索引名# resp = requests.delete(DNS_API, headers=header)resp = requests.put(DNS_API, headers=header, data=json.dumps(data).encode())print(resp.status_code)if resp.status_code == 200:print(u"max ok")else:print(resp.text)except Exception as e:print(e, u"建立索引失败")if __name__ == '__main__':set_fielddata()# max_count()
ElasticSearch ected map for property [fields] on field [subject_id] but got a class java.lang相关推荐
- 【java运行报错】Can not set java.lang.String field com.iS.UserEntity.name to java.lang.Class
[java运行报错]Can not set java.lang.String field com.iS.UserEntity.name to java.lang.Class 原因: 解决办法 总结:仰 ...
- Could not set property ‘xxx‘ of ‘class ‘xxx‘ with value ‘xxx‘,Cause: java.lang.IllegalArgumentExcept
这个是我要运行的代码 这个是这段代码报的错. Cause: org.apache.ibatis.reflection.ReflectionException: Could not set proper ...
- Could not copy property 'intro' from source to target; nested exception is java.lang.reflect.Invocat
在使用BeanUtil copyProperties时,对两个不同的对象,但是大部分字段相同的对象进行复制时,出现了上面的错误,里面还有一些ClassCastException之类的. 但是复制失败的 ...
- 已解决java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map异常的正确解决方法,亲测有效!!
已解决java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map异常的正确解决方法,亲测有效!! ...
- Cannot convert value of type ‘java.lang.String‘ to required type ‘java.util.Map‘ for property ‘param
问题描述 若依中使用feign进行远程调用,在get请求中使用@SpringQueryMap映射对象时,映射对象的父类中带有Map<String, Object>类型的params属性时, ...
- mybaits错误解决:There is no getter for property named 'parentId ' in class 'java.lang.String'
在使用mybaitis传参数的时候,如果仅传入一个类型为String的参数,那么在 xml文件中应该使用_parameter来代替参数名. 比如mapper中如下方法,只有一个String值 publ ...
- java反射设置access_Java反射之java.lang.reflect.Field
前面一章 讲了怎么通过Class获取到成员(成员变量.成员方法.构造器),本篇文章开始详细讲解成员变量(java.lang.reflect.Field)的详细用法. 获取field的类型 有两种方式可 ...
- Spring Data ElasticSearch删除索引遇到的java.lang.IllegalStateException: Failed to load ApplicationContext异常
异常内容如下: log4j:WARN No appenders could be found for logger (org.springframework.test.context.junit4.S ...
- Mybatis There is no getter for property named 'XXX' in 'class java.lang.XXX
Mybatis查询 使用Mybatis查询时,其参数可以是基本数据类型或者像Integer和String这样的简单的数据对象,也可以是复杂对象(一般是指JavaBean)或者map等,当使用基本数据类 ...
最新文章
- [导入]Nhibernate引入自定义Membership和Role
- Science:充满铵盐的环境依然发生固氮
- 我终于加上博士大佬的微信!攒了近百个技术问题,一口气解决!(文末有福利)...
- 二进制包 mysql_二进制包;mysql
- api质量等级_第1150期 简单又易操作的辨别润滑油质量的方法
- Day 19: EmberJS 入门指南
- cuda profiler使用
- andorid 第一天 搭建环境(于本博另一篇文章 ubuntu下安装andoird SDK相同内容)
- Linux中断(interrupt)子系统之五:软件中断(softIRQ)
- Behavior Language Processing with Graph based Feature Generation for Fraud DetectioninOnline Lending
- 面向对象——意图与逻辑
- 微信小程序云开发教程-云函数操作数据库-增、查
- css完成图片预加载,图片预加载
- J2EE(集合框架)
- 推荐10款最好的免费项目管理工具
- ps快捷键大全(表格汇总)
- 【转】奇幻RPG(人物构造 与 Abstract Factory模式)
- python基础:Python MySQL
- luogu P4694 [PA2013]Raper
- 红外和可见光图像融合算法研究
热门文章
- oracle查sysdate,Oracle 日期查询语句小结
- C 整数反转
- OpenvSwitch命令总结
- 南京林业大学计算机专升本,2018江苏专转本学校之:南京林业大学
- java ug二次开发_使用Java进行UG二次开发:简单的例子(上) | 学步园
- ajax怎样获得表头信息,layui.table动态获取表头和列表数据示例
- html tfoot标签,HTML tfoot 标签
- 汇编语言带C循环,如何将此C for循环转换为汇编语言?
- 当程序员产崽后...
- SpringBoot + WebMagic实现一个的爬虫框架