Skip to content

Instantly share code, notes, and snippets.

@kimchy
Created June 8, 2012 22:01
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save kimchy/2898285 to your computer and use it in GitHub Desktop.
Save kimchy/2898285 to your computer and use it in GitHub Desktop.
curl -XPUT localhost:9200/test
curl -XPUT http://localhost:9200/test/data/_mapping -d '{
"data" : {
"dynamic_templates" : [
{
"string_template" : {
"match" : "*",
"match_mapping_type" : "string",
"mapping" : {
"type" : "multi_field",
"fields" : {
"{name}" : {"type": "string", "index" : "analyzed", "analyzer" : "default", "store" : "false", "include_in_all": "true"},
"{name}_untouched" : {"type": "string", "index" : "analyzed", "analyzer" : "simple", "store" : "false"}
}
}
}
}
]
}
}'
curl -XPUT http://localhost:9200/test -d '{
"mappings" : {
"_default_" : {
"dynamic_templates" : [
{
"string_template" : {
"match" : "*",
"match_mapping_type" : "string",
"mapping" : {
"type" : "multi_field",
"fields" : {
"{name}" : {"type": "string", "index" : "analyzed", "analyzer" : "default", "store" : "false", "include_in_all": "true"},
"{name}_untouched" : {"type": "string", "index" : "analyzed", "analyzer" : "simple", "store" : "false", "include_in_all": "true"}
}
}
}
}
]
}
}
}'
When I now add an object:
curl -XPUT http://localhost:9200/test/data/1 -d '{
"name" : "michael",
"company" : {
name: "foobar"
}
}'
@liujl
Copy link

liujl commented Aug 28, 2013

greate

@terry2040
Copy link

thx!

@channainfo
Copy link

awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment