Skip to content

Instantly share code, notes, and snippets.

@nickhoffman
Created January 31, 2012 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickhoffman/614309d5473552732379 to your computer and use it in GitHub Desktop.
Save nickhoffman/614309d5473552732379 to your computer and use it in GitHub Desktop.
Why is "bars.colour.analyzed" not included in all?
# As you can see below, "bars.*.analyzed" is configured to be included in _all .
curl -X DELETE 'localhost:9200/test?pretty=true'
echo
curl -X PUT 'localhost:9200/test?pretty=true'
echo
curl -X PUT 'localhost:9200/test/item/_mapping?pretty=true' -d '
{
"item": {
"dynamic_templates": [
{
"string_property": {
"match_mapping_type": "string",
"path_match" : "bars.*",
"mapping" : {
"type" : "multi_field",
"fields": {
"{name}": {
"type" : "{dynamic_type}",
"index" : "not_analyzed",
"include_in_all": false
},
"analyzed": {
"type" : "{dynamic_type}",
"index" : "analyzed",
"include_in_all": true
}
}
}
}
}
]
}
}
'
echo
curl -X POST 'localhost:9200/test/item/1' -d '
{ name: "Item 1", bars: [ {colour: "red"} ] }
'
echo
# The dynamic mapping says that analyzed fields in "bars" should be included in _all .
#
# However, getting the mapping shows that "bars.colour.analyzed" is NOT included in _all .
curl 'localhost:9200/test/item/_mapping?pretty=1'
{
"item" : {
"dynamic_templates" : [ {
"string_property" : {
"mapping" : {
"type" : "multi_field",
"fields" : {
"analyzed" : {
"include_in_all" : true,
"index" : "analyzed",
"type" : "{dynamic_type}"
},
"{name}" : {
"include_in_all" : false,
"index" : "not_analyzed",
"type" : "{dynamic_type}"
}
}
},
"match_mapping_type" : "string",
"path_match" : "bars.*"
}
} ],
"properties" : {
"name" : {
"type" : "string"
},
"bars" : {
"dynamic" : "true",
"properties" : {
"colour" : {
"type" : "multi_field",
"fields" : {
"colour" : {
"include_in_all" : false,
"index" : "not_analyzed",
"type" : "string"
},
"analyzed" : {
"include_in_all" : false,
"type" : "string"
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment