Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change in index_in_parent doesn't work, but throws no error #53792

Closed
AndyHunt66 opened this issue Mar 19, 2020 · 2 comments · Fixed by #54386
Closed

Change in index_in_parent doesn't work, but throws no error #53792

AndyHunt66 opened this issue Mar 19, 2020 · 2 comments · Fixed by #54386
Labels
>bug help wanted adoptme :Search/Mapping Index mappings, including merging and defining field types

Comments

@AndyHunt66
Copy link
Contributor

Elasticsearch version (bin/elasticsearch --version): 6.8.6 / 7.6.0

Description:
Trying to change the value of index_in_parent seems to succeed, but doesn't.
I would expect that it is working as designed that that value cannot be changed, but I think it's a bug that no error is returned when trying to change it.

Steps to Reproduce:

PUT /parenttest
PUT /parenttest/_mapping/_doc
{
  "properties": {
    "email": {
      "type": "keyword"
    },

            "user" : {
                "type" : "nested",
                "include_in_parent": true,
                "properties": {
                    "first" : {"type": "text" },
                    "last"  : {"type": "text" }
                }
            }

  }
}
GET parenttest
PUT /parenttest/_mapping/_doc
{
  "properties": {
    "email": {
      "type": "keyword"
    },

            "user" : {
                "type" : "nested",
                "include_in_parent": false,
                "properties": {
                    "first" : {"type": "text" },
                    "last"  : {"type": "text" }
                }
            }

  }
}
GET parenttest

Expected behaviour:
The third PUT returns an error explaining that it's not possible to change the value of "include_in_parent"

Observed Behaviour:
None of the calls throws an error.
The second GET returns exactly the same data as the first.

@AndyHunt66 AndyHunt66 added the :Search/Mapping Index mappings, including merging and defining field types label Mar 19, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/Mapping)

@jtibshirani
Copy link
Contributor

Thanks @AndyHunt66 for reporting this. I agree that we should throw an error when attempting to change the values for these parameters. The alternative is to add support for changing the value. This would allow for a situation in which some documents contain the values in the parent/ root but others do not, which is a strange index state and could cause confusion when querying against these fields.

jtibshirani pushed a commit that referenced this issue Apr 16, 2020
#54386)

The main changes are:
1. Throw an error when updating `include_in_parent` or `include_in_root` attribute of nested field dynamically by the PUT mapping API.
2. Add a test for the change.

Closes #53792
jtibshirani pushed a commit to jtibshirani/elasticsearch that referenced this issue Apr 16, 2020
elastic#54386)

The main changes are:
1. Throw an error when updating `include_in_parent` or `include_in_root` attribute of nested field dynamically by the PUT mapping API.
2. Add a test for the change.

Closes elastic#53792
jtibshirani added a commit that referenced this issue Apr 16, 2020
The main changes are:
1. Throw an error when updating `include_in_parent` or `include_in_root` attribute of nested field dynamically by the PUT mapping API.
2. Add a test for the change.

Closes #53792

Co-authored-by: bellengao <gbl_long@163.com>
yyff pushed a commit to yyff/elasticsearch that referenced this issue Apr 17, 2020
elastic#54386)

The main changes are:
1. Throw an error when updating `include_in_parent` or `include_in_root` attribute of nested field dynamically by the PUT mapping API.
2. Add a test for the change.

Closes elastic#53792
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug help wanted adoptme :Search/Mapping Index mappings, including merging and defining field types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants