Sai Krishna
Sai Krishna

Reputation: 624

Does elasticsearch consider empty string as null?

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.

Upvotes: 0

Views: 3827

Answers (1)

alpert
alpert

Reputation: 4655

Elasticsearch 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

Upvotes: 1

Related Questions