Skip to content

Instantly share code, notes, and snippets.

@sakrafd
Created August 24, 2011 20:04
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 sakrafd/1169047 to your computer and use it in GitHub Desktop.
Save sakrafd/1169047 to your computer and use it in GitHub Desktop.
dynamic templates combined with mappings
$ curl -X POST "http://localhost:9200/users_test" -d '
{ "user": {
"dynamic_templates":[{
"long": {
"match_mapping_type":"long",
"match":"*",
"mapping":{ "omit_term_freq_and_positions":true,
"store":"no",
"type":"long",
"omit_norms":true,
"index":"analyzed",
"include_in_all":false }
}}]},
"mapping": {
"properties":{"birthdate":{"null_value":-62167392000,"type":"long"}
}
}
}'
{"ok":true,"acknowledged":true}
$ curl -X GET "http://localhost:9200/users_test/_mapping?pretty=true"
{
"users_test" : {
}
}
$ curl -X GET "http://localhost:9200/users_test/_settings?pretty=true"
{
"users_test" : {
"settings" : {
"index.mapping.properties.birthdate.null_value" : "-62167392000",
"index.user.dynamic_templates.0.long.mapping.store" : "no",
"index.user.dynamic_templates.0.long.match_mapping_type" : "long",
"index.user.dynamic_templates.0.long.mapping.include_in_all" : "false",
"index.user.dynamic_templates.0.long.match" : "*",
"index.user.dynamic_templates.0.long.mapping.omit_term_freq_and_positions" : "true",
"index.user.dynamic_templates.0.long.mapping.index" : "analyzed",
"index.mapping.properties.birthdate.type" : "long",
"index.user.dynamic_templates.0.long.mapping.omit_norms" : "true",
"index.user.dynamic_templates.0.long.mapping.type" : "long",
"index.number_of_shards" : "5",
"index.number_of_replicas" : "1"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment