Elasticsearch: Allows to create indexed fields when setting enabled to false to the object field

Created on 27 Feb 2019  路  4Comments  路  Source: elastic/elasticsearch

Elasticsearch version (bin/elasticsearch --version):

~
Version: Tested 6.0 and 6.6
~

Plugins installed: none

JVM version (java -version):
~
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)
~

OS version (uname -a if on a Unix-like system):

~
Darwin x.local 18.2.0 Darwin Kernel Version 18.2.0: Thu Dec 20 20:46:53 PST 2018; root:xnu-4903.241.1~1/RELEASE_X86_64 x86_64
~

Description of the problem including expected versus actual behavior:
ES updates the mapping creating indexed fields where one should not when setting enabled to false property to the object field.

Steps to reproduce:

~~~
PUT my_index
{
"mappings": {
"_doc": {
"properties": {
"name": {
"enabled": false
}
}
}
}
}

the field is enabled - which is NOT the expected value

PUT my_index/_doc/1
{
"name.first": "john"
}

GET my_index/_mapping

response

{
"my_index" : {
"mappings" : {
"_doc" : {
"properties" : {
"name" : {
"enabled" : false,
"properties" : {
"first" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
}
}
}
}
}
}

DELETE my_index

PUT my_index
{
"mappings": {
"_doc": {
"properties": {
"name": {
"enabled": false
}
}
}
}
}

the field is not enabled - which is the expected value

PUT my_index/_doc/1
{
"name": {
"first": "john"
}
}

GET my_index/_mapping

response

{
"my_index" : {
"mappings" : {
"_doc" : {
"properties" : {
"name" : {
"type" : "object",
"enabled" : false
}
}
}
}
}
}
~~~

:SearcMapping >bug help wanted

All 4 comments

Pinging @elastic/es-search

Thank you @tamros for this bug report. I was able to reproduce the issue, and it looks like we are not properly checking the enabled flag when fields are specified in dot notation.

I'm looking into this :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rjernst picture rjernst  路  3Comments

ttaranov picture ttaranov  路  3Comments

martijnvg picture martijnvg  路  3Comments

Praveen82 picture Praveen82  路  3Comments

clintongormley picture clintongormley  路  3Comments