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

Changing field type with create_mapping just hides the error #24

Closed
clintongormley opened this issue Feb 18, 2010 · 3 comments
Closed

Comments

@clintongormley
Copy link

Easier to give an example than to explain:
- on a new cluster (ie no indices, no mappings)
- index a document with eg { foo: 123 } # sets type of foo to 'int'
- index a doc with { foo : "bar" } # throws an error
- create a mapping and set foo's type to 'string'
- index the doc with { foo: "bar"} # ok
- search for {term: { foo: 123}} # 1 hit
- search for {term: { foo: "bar"}} # no hits

So setting the mapping doesn't change the type of 'foo', it just hides the error message later on.

This seems inconsistent to me - it should either change the type of 'foo' going forward, or throw an error when you try to change the type with create_mapping.

Log file follows:

curl -XPUT http://127.0.0.2:9200/twitter/tweet/1 -d '{
   "foo" : 123
}
'
# {
#    "ok" : true,
#    "_index" : "twitter",
#    "_id" : "1",
#    "_type" : "tweet"
# }


curl -XPUT http://127.0.0.2:9200/twitter/tweet/2 -d '{
   "foo" : "bar"
}
'
# {
#    "debug" : {
#       "at" : {
#          "className" : "java.lang.Thread",
#          "methodName" : "run",
#          "fileName" : "Thread.java",
#          "lineNumber" : 619
#       },
#       "cause" : {
#          "at" : {
#             "className" : "java.lang.Thread",
#             "methodName" : "run",
#             "fileName" : "Thread.java",
#             "lineNumber" : 619
#          },
#          "message" : "Current token (VALUE_STRING) not numeric, c
# >         an not use numeric value accessors\n at [Source: {\n   
#       },
#       "message" : "Index[twitter] Shard[1] "
#    },
#    "error" : "Index[twitter] Shard[1] ; nested: Failed to parse; 
# >   nested: Current token (VALUE_STRING) not numeric, can not use
# }


curl -XPUT http://127.0.0.2:9200/_all/tweet/_mapping -d '{
   "properties" : {
      "foo" : {
         "type" : "string"
      }
   }
}
'
# {
#    "ok" : true
# }


curl -XPUT http://127.0.0.2:9200/twitter/tweet/2 -d '{
   "foo" : "bar"
}
'
# {
#    "ok" : true,
#    "_index" : "twitter",
#    "_id" : "2",
#    "_type" : "tweet"
# }


curl -XGET http://127.0.0.2:9200/twitter/tweet/_search -d '{
   "query" : {
      "term" : {
         "foo" : "123"
      }
   }
}
'
# {
#    "hits" : {
#       "hits" : [],
#       "total" : 0
#    },
#    "_shards" : {
#       "failed" : 0,
#       "successful" : 5,
#       "total" : 5
#    }
# }


curl -XGET http://127.0.0.2:9200/twitter/tweet/_search -d '{
   "query" : {
      "term" : {
         "foo" : "bar"
      }
   }
}
'
# {
#    "hits" : {
#       "hits" : [],
#       "total" : 0
#    },
#    "_shards" : {
#       "failed" : 5,
#       "successful" : 0,
#       "total" : 5
#    }
# }
@kimchy
Copy link
Member

kimchy commented Mar 1, 2010

part of the mapper overhaul, this scenario should now work as expected. Basically, putting the new mapping will ignore conflicts so no exception on it

@clintongormley
Copy link
Author

This works now. I note that searching on the wrong type (eg field set to type integer, and search for 'foo') now throws this error:

"SearchParseException[[twitter][0]: query[null],from[-1],size[-1]: Parse Failure [Failed to parse [[B@7e054643]]]; nested: NumberFormatException[For input string: "bar"]; "

May be worth tidying that up :)

@kimchy
Copy link
Member

kimchy commented Mar 2, 2010

There is so much more work on getting proper exceptions out :)

kimchy added a commit that referenced this issue Jun 5, 2015
dadoonet added a commit that referenced this issue Jun 5, 2015
Closes #24.
(cherry picked from commit 1596bf6)
dadoonet added a commit that referenced this issue Jun 5, 2015
Closes #24.
(cherry picked from commit aca83a7)
dadoonet added a commit that referenced this issue Jun 5, 2015
Related to #24.

(cherry picked from commit ee289c9)
dadoonet added a commit that referenced this issue Jun 5, 2015
Closes #24.

(cherry picked from commit 9c62411)
dadoonet added a commit that referenced this issue Jun 5, 2015
were deprecated in 2.2.0 by #22.

Closes #24.

(cherry picked from commit 2bab6e0)
dadoonet added a commit that referenced this issue Jun 5, 2015
Closes #24.

(cherry picked from commit 13c60e4)
dadoonet added a commit that referenced this issue Jun 5, 2015
With change #24, non integration can not run anymore.

(cherry picked from commit 76eecc8)
dadoonet added a commit that referenced this issue Jun 9, 2015
Closes #24.
(cherry picked from commit e03a16b)
tlrx added a commit that referenced this issue Jun 9, 2015
rmuir pushed a commit to rmuir/elasticsearch that referenced this issue Nov 8, 2015
Due to refactoring in 0.21.x we have to update this plugin
Closes elastic#24.
ClaudioMFreitas pushed a commit to ClaudioMFreitas/elasticsearch-1 that referenced this issue Nov 12, 2019
Added functionality to install .deb from an downloaded file instead of repository.
henningandersen pushed a commit to henningandersen/elasticsearch that referenced this issue Jun 4, 2020
…types (elastic#24)

* Split large shard sizing into two challenges and added additional id types

* Updated README.md file for revised large shard sizing tests

* Updated following review.

* Updated to use default Rally refresh operation
williamrandolph pushed a commit to williamrandolph/elasticsearch that referenced this issue Jun 4, 2020
mindw pushed a commit to mindw/elasticsearch that referenced this issue Sep 5, 2022
)

* Initial implementation for auto-scaling ant-media cluster

Use AWS to dynamically scale up/down ant-media cluster size.
Future improvements:

* Tune scaling type and parameters based on experimentation.
* Use AWS auto-scaling scheduling to preconfigure cluster size for scheduled
  classes.

https://engageli.atlassian.net/browse/MPC-758

Approved-by: Alan Nuchnoi
cbuescher pushed a commit to cbuescher/elasticsearch that referenced this issue Oct 2, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants