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

Completion type mapping is not idempotent #8937

Closed
missinglink opened this issue Dec 12, 2014 · 1 comment
Closed

Completion type mapping is not idempotent #8937

missinglink opened this issue Dec 12, 2014 · 1 comment
Assignees
Labels
>bug :Search/Mapping Index mappings, including merging and defining field types

Comments

@missinglink
Copy link
Contributor

Completion mapping is not idempotent in the same way other field types are, probably due to the internal re-ordering of the precision array.

In the example below you can see that updating the mapping twice causes an error, if you start afresh and use the precision values [ 1,2,3 ] the issue goes away.

Note when you PUT the mapping as below and then GET it back you'll notice the ordering of the precision array is now [2,3,1,4].

#!/bin/bash

################################################
# Completion Mapping Idempotence
################################################

ES='localhost:9200';

# drop/create index
curl -s -XDELETE "$ES/testcase?pretty=true" >/dev/null;
curl -s -XPUT "$ES/testcase?pretty=true" >/dev/null;

# update mapping
update_mapping() {
  curl -s -XPUT "$ES/testcase/_mapping/mytype?pretty=true" -d '
  {
     "properties": {
        "suggest": {
           "type": "completion",
           "context": {
              "location": {
                 "type": "geo",
                 "precision": [ 1, 2, 3, 4 ]
              }
           }
        }
     }
  }';
}

update_mapping;
# "acknowledged" : true

update_mapping;
# "error" : "MergeMappingException[Merge failed with failures {[mapper [suggest] has different 'context_mapping' values]}]"

curl -s "$ES/testcase/mytype/_mapping?pretty=true" | grep precision
# "precision" : [ 2, 3, 1, 4 ]

cc/ @markharwood as it may be related to c0aef4a and @areek as it relates to context suggesters

@missinglink
Copy link
Contributor Author

curl -s localhost:9200/
{
  "status" : 200,
  "name" : "Alcmena",
  "version" : {
    "number" : "1.3.4",
    "build_hash" : "a70f3ccb52200f8f2c87e9c370c6597448eb3e45",
    "build_timestamp" : "2014-09-30T09:07:17Z",
    "build_snapshot" : false,
    "lucene_version" : "4.9"
  },
  "tagline" : "You Know, for Search"
}

@clintongormley clintongormley added >bug :Search/Mapping Index mappings, including merging and defining field types labels Apr 14, 2015
areek added a commit to areek/elasticsearch that referenced this issue Apr 15, 2015
areek added a commit to areek/elasticsearch that referenced this issue Apr 15, 2015
@areek areek closed this as completed in c326738 Apr 15, 2015
areek added a commit that referenced this issue Apr 15, 2015
areek added a commit that referenced this issue Apr 15, 2015
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :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