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

Mapping: Fix possibility of losing meta configuration on field mapping update #5053

Closed
shaunhall opened this issue Feb 7, 2014 · 6 comments · Fixed by #6550
Closed

Mapping: Fix possibility of losing meta configuration on field mapping update #5053

shaunhall opened this issue Feb 7, 2014 · 6 comments · Fixed by #6550

Comments

@shaunhall
Copy link

Create a new schema with a field and the _timestamp field enabled:

curl -XPOST http://localhost:9200/foo -d '
{
"mappings": {
"product": {
"_timestamp" : { "enabled" : true },
"properties": {
"field1": { "type": "integer" }
}
}
}
}'

Retrieve the mapping, all looks good:
curl http://localhost:9200/foo/_mapping
{"foo":{"product":{"_timestamp":{"enabled":true},"properties":{"field1":{"type":"integer"}}}}}

Now add another field:
curl -XPUT http://localhost:9200/foo/product/_mapping -d '
{
"product" : {
"properties": {
"field2" : {"type" : "integer" }
}
}
}
'
Get the mapping again:
curl http://localhost:9200/foo/_mapping
{"foo":{"product":{"properties":{"field1":{"type":"integer"},"field2":{"type":"integer"}}}}}

The _timestamp field is gone!

@shaunhall
Copy link
Author

version 0.90.3

@spinscale spinscale self-assigned this Feb 10, 2014
@spinscale
Copy link
Contributor

Hey

I cannot reproduce this with any of the 0.90 release (tried .0, .3 and .11).

The URLs you provided are not valid (must be _mapping and the PUT call actual create a document called mapping in the foo index. Can you fix this and provide a working example, so we can either find out if this is a bug on elasticsearch side or maybe your HTTP calls are not correct.

Thanks!

@shaunhall
Copy link
Author

Sorry, formatting fail :). Have updated the CURLs. Thanks.

@shaunhall
Copy link
Author

any update? I'll fix this if not

@hanneskaeufler
Copy link
Contributor

Whoah, I just ran into this today. Heres my test case:
https://gist.github.com/hanneskaeufler/2b6d69a2fc1a77509500

I´m running version 1.1.2

Is that expected behaviour or a bug?

@spinscale
Copy link
Contributor

hey there,

this looks like a bug indeed from a birds eye view, I will take a look as soon as I can!

spinscale added a commit to spinscale/elasticsearch that referenced this issue Jun 19, 2014
…g update

The TTL, size, timestamp and index meta properties could be lost on an
update of a single field mapping due to a wrong comparison in the
merge method (which was caused by a wrong initialization, which marked
an update as explicitely disabled instead of unset.

Closes elastic#5053
spinscale added a commit that referenced this issue Jun 19, 2014
…g update

The TTL, size, timestamp and index meta properties could be lost on an
update of a single field mapping due to a wrong comparison in the
merge method (which was caused by a wrong initialization, which marked
an update as explicitely disabled instead of unset.

Closes #5053
spinscale added a commit that referenced this issue Jun 19, 2014
…g update

The TTL, size, timestamp and index meta properties could be lost on an
update of a single field mapping due to a wrong comparison in the
merge method (which was caused by a wrong initialization, which marked
an update as explicitely disabled instead of unset.

Closes #5053
@spinscale spinscale changed the title PUT to add a field removes the _timestamp field Mapping: Fix possibility of losing meta configuration on field mapping update Jun 19, 2014
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
…g update

The TTL, size, timestamp and index meta properties could be lost on an
update of a single field mapping due to a wrong comparison in the
merge method (which was caused by a wrong initialization, which marked
an update as explicitely disabled instead of unset.

Closes elastic#5053
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants