Description
Elasticsearch version (bin/elasticsearch --version
):
Version: 7.9.0, Build: default/tar/a479a2a7fce0389512d6a9361301708b92dff667/2020-08-11T21:36:48.204330Z, JVM: 11.0.7
Plugins installed: []
None
JVM version (java -version
):
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.7+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.7+10, mixed mode)
OS version (uname -a
if on a Unix-like system):
Darwin myron3.local 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64
Description of the problem including expected versus actual behavior:
In 7.8, this worked:
- Create an index with a string property in the mapping with no null_value
- Use PUT mapping to set the null value on the string property
In 7.9, the PUT mapping call does not explicitly fail, but it does not update the mapping, either.
Steps to reproduce:
Here's a bash script that reproduces it:
#!/usr/bin/env bash
port=$1
url_root="http://localhost:$port"
echo 'Elasticversion:'
curl -is $url_root | grep number
echo
echo 'Deleting example_index to have a clean slate...'
curl -X DELETE -H 'Content-type: application/json' $url_root/example_index?ignore_unavailable=true
echo
echo
echo 'Creating example_index with mapping property name with no null_value parameter'
curl -X PUT -d '{"aliases":{},"mappings":{"dynamic":"strict","properties":{"id":{"type":"keyword"},"name":{"type":"keyword"}}}}' -H 'Content-type: application/json' $url_root/example_index
echo
echo
echo 'The current index mapping is:'
curl -X GET -H 'Content-type: application/json' $url_root/example_index
echo
echo
echo 'Setting `null_value: Anonymous` on the `name` property'
curl -X PUT -d '{"dynamic":"strict","properties":{"id":{"type":"keyword"},"name":{"type":"keyword","null_value":"Anonymous"}}}' -H 'Content-type: application/json' $url_root/example_index/_mappings
echo
echo
echo 'The current index mapping is:'
curl -X GET -H 'Content-type: application/json' $url_root/example_index
echo
I am running Elasticsearch 7.9.0 on port 9234 and Elasticsearch 7.8.1 on 9734. Here's the output from running my test script against 7.9 vs 7.8.
First, against 7.8:
$ script/test_es_put_mapping 9734
Elasticversion:
"number" : "7.8.0",
Deleting example_index to have a clean slate...
{"acknowledged":true}
Creating example_index with mapping property name with no null_value parameter
{"acknowledged":true,"shards_acknowledged":true,"index":"example_index"}
The current index mapping is:
{"example_index":{"aliases":{},"mappings":{"dynamic":"strict","properties":{"id":{"type":"keyword"},"name":{"type":"keyword"}}},"settings":{"index":{"creation_date":"1597960745381","number_of_shards":"1","number_of_replicas":"1","uuid":"QG7QFLspQzGPKgUlwsqb4Q","version":{"created":"7080099"},"provided_name":"example_index"}}}}
Setting `null_value: Anonymous` on the `name` property
{"acknowledged":true}
The current index mapping is:
{"example_index":{"aliases":{},"mappings":{"dynamic":"strict","properties":{"id":{"type":"keyword"},"name":{"type":"keyword","null_value":"Anonymous"}}},"settings":{"index":{"creation_date":"1597960745381","number_of_shards":"1","number_of_replicas":"1","uuid":"QG7QFLspQzGPKgUlwsqb4Q","version":{"created":"7080099"},"provided_name":"example_index"}}}}
As you can see, the mapping gets updated with "null_value":"Anonymous"
on the name
property.
Here's the result on 7.9.0:
$ script/test_es_put_mapping 9234
Elasticversion:
"number" : "7.9.0",
Deleting example_index to have a clean slate...
{"acknowledged":true}
Creating example_index with mapping property name with no null_value parameter
{"acknowledged":true,"shards_acknowledged":true,"index":"example_index"}
The current index mapping is:
{"example_index":{"aliases":{},"mappings":{"dynamic":"strict","properties":{"id":{"type":"keyword"},"name":{"type":"keyword"}}},"settings":{"index":{"creation_date":"1597960791597","number_of_shards":"1","number_of_replicas":"1","uuid":"bClFvT8yRbSD8in6M1VKhg","version":{"created":"7090099"},"provided_name":"example_index"}}}}
Setting `null_value: Anonymous` on the `name` property
{"acknowledged":true}
The current index mapping is:
{"example_index":{"aliases":{},"mappings":{"dynamic":"strict","properties":{"id":{"type":"keyword"},"name":{"type":"keyword"}}},"settings":{"index":{"creation_date":"1597960791597","number_of_shards":"1","number_of_replicas":"1","uuid":"bClFvT8yRbSD8in6M1VKhg","version":{"created":"7090099"},"provided_name":"example_index"}}}}
As you can see, on 7.9, the PUT mapping call resulted in a successful {"acknowledged":true}
response but it did not actually update the mapping.