我在映射中有以下内容。 id有时可以为null,所以我正在使用null_value:1。
"Id" : {
"type" : "integer",
"store" : true,
"doc_values" : true,
"null_value" : 1,
"index":"not_analyzed"
},
当我尝试将文档添加到索引时,仍然出现解析错误。我怎样才能解决这个问题?
[2017-12-24 10:42:42,601][DEBUG][action.bulk ][test-2017-12-24]
[7] failed to execute bulk item (index) index {[test-2017-12-24][test]
org.elasticsearch.index.mapper.MapperParsingException: failed to parse [Id]
at
Caused by: java.lang.NumberFormatException: For input string: "null"
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.parseInt(Integer.java:615)
最佳答案
从错误中您可以看到您尝试在Id字段中为字符串"null"
编制索引,该字符串无法解析为(可为空)整数。尝试输入null
(不带引号)
关于elasticsearch - elasticsearch null_value替换不适用于整数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47962076/