-
-
Save nickhoffman/614309d5473552732379 to your computer and use it in GitHub Desktop.
Why is "bars.colour.analyzed" not included in all?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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