Does elasticsearch consider empty string as null?

南楼画角 提交于 2020-01-25 08:43:07

问题


I would like to know if elasticsearch considers empty string as null value, but based on my mapping shown below, I don't see that it is doing that. How can I make elasticsearch consider empty string as a null and index using the value provided by null_value. My mapping is shown below:

{
    "mapping": {
        "my_typee": {
            "properties": {
                "autoRank": {
                    "type": "integer",
                    "null_value": 0,
                    "store": true,
                    "index": "analyzed"
                }
            }
        }
    }
}

Thanks in advance.


回答1:


Ealsticsearch does not index empty strings. In your case your field is actually not string but an integer of type. And null_value option is actually does what you want to do. You dont need to do anything extra.

https://www.elastic.co/guide/en/elasticsearch/reference/current/null-value.html



来源:https://stackoverflow.com/questions/36858577/does-elasticsearch-consider-empty-string-as-null

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!