Skip to content

Instantly share code, notes, and snippets.

@konradkonrad
Created April 7, 2015 11:30
Show Gist options
  • Save konradkonrad/16220520eb9bacc1f6e6 to your computer and use it in GitHub Desktop.
Save konradkonrad/16220520eb9bacc1f6e6 to your computer and use it in GitHub Desktop.
Elasticsearch silently ignores mis-structured mapping
curl -XDELETE localhost:9200/mytest
curl -XPUT localhost:9200/mytest
curl -XPUT localhost:9200/mytest/t1/_mapping -d '{
"t1": {
"_source": {"enabled": false},
"properties": {
"_all": {"enabled": false},
"field1": {"type": "string"},
"field2": {"type": "long"},
"_underscore1": {"type": "string"},
"_underscore2": {"enabled": true}}}}'
curl -XGET "localhost:9200/_mapping?pretty"
# will yield:
#{
# "mytest" : {
# "mappings" : {
# "t1" : {
# "_source" : {
# "enabled" : false
# },
# "properties" : {
# "_underscore1" : {
# "type" : "string"
# },
# "_underscore2" : {
# "type" : "object"
# },
# "field1" : {
# "type" : "string"
# },
# "field2" : {
# "type" : "long"
# }
# }
# }
# }
# }
#}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment