简体   繁体   中英

elasticsearch null_value replacement not working for integers

i have the following in my mapping. The id can be null sometimes so i am using null_value : 1.

 "Id" : {
        "type" : "integer",
        "store" : true,
        "doc_values" : true,
        "null_value" : 1,
        "index":"not_analyzed"
},

when I try to add documents to the index, I am still getting parse error. How can I fix this?

[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)

From the error you can see that you try to index the string "null" in the Id field, which it cannot parse into a (nullable) integer. Try putting in null (without quotes)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM