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

Can't modify mapping if it has a parent #4719

Closed
kzwang opened this issue Jan 14, 2014 · 1 comment
Closed

Can't modify mapping if it has a parent #4719

kzwang opened this issue Jan 14, 2014 · 1 comment

Comments

@kzwang
Copy link
Contributor

kzwang commented Jan 14, 2014

If a type mapping with a parent is already exist, it can't be updated even if we are not modify the parent.

Seems related to #3849

I think that issue should be not allow to update the parent field in the mapping, however it will throw this exception even if we are updating other fields for mapping with parent

org.elasticsearch.index.mapper.MergeMappingException: Merge failed with failures {[The _parent field can't be added or updated]}" 

Example:

# create mapping for tweet
curl -XPUT localhost:9200/test/tweet/_mapping -d '{
    "tweet" : {
        "properties" : {
            "message" : {"type" : "string", "store" : "yes"}
        }
    }
}'

# create mapping for tweet2 with parent tweet
curl -XPUT localhost:9200/test/tweet2/_mapping -d '{
    "tweet2": {
        "_parent": {"type": "tweet"},
        "properties": {
            "message": {"type": "string", "store": "yes"}
        }
    }
}'

# add a new property to tweet2 mapping, it's not modifying the parent but still got exception
curl -XPUT localhost:9200/test/tweet2/_mapping -d '{
    "tweet2" : {
        "properties" : {
            "message2" : {"type" : "string", "store" : "yes"}
        }
    }
}'
@kzwang
Copy link
Contributor Author

kzwang commented Feb 1, 2014

If the updated mapping has a "_parent" with same value it can be successfully merged

@kzwang kzwang closed this as completed Feb 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant