es java api 设置index mapping 报错 mapping source must be pairs of fieldnames and properties definition.


java.lang.IllegalArgumentException: mapping source must be pairs of fieldnames and properties definition.

 

从es官网找到的

request.mapping("_doc",  "{\n" + " \"_doc\": {\n" + " \"properties\": {\n" + " \"message\": {\n" + " \"type\": \"text\"\n" + " }\n" + " }\n" + " }\n" + "}",  XContentType.JSON);
不生效并报错
查看源码,发现mapping的第二个参数,要求必须为 %2==0,改为
request.mapping("_doc", "datetime", "type=date");
多个参数
request.mapping("_doc", "datetime", "type=date", "string", "type=text");

 

 




免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM