Skip to content

Instantly share code, notes, and snippets.

@mattweber
Created February 18, 2012 16:30
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 mattweber/1860066 to your computer and use it in GitHub Desktop.
Save mattweber/1860066 to your computer and use it in GitHub Desktop.
curl -XPUT 'http://localhost:9200/testing' -d '{
"mappings" : {
"testa" : {
"_source" : {
"enabled" : true
},
"properties" : {
"field1" : {"type" : "string", "store" : "yes"},
"field2" : {"type" : "string", "store" : "yes"}
}
}
}
}'
{
"took" : 62,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 2,
"max_score" : 0.30685282,
"hits" : [ {
"_index" : "testing",
"_type" : "testa",
"_id" : "1",
"_score" : 0.30685282,
"fields" : {
"field1" : "testa_field1",
"field2" : "testa_field2"
}
}, {
"_index" : "testing",
"_type" : "testb",
"_id" : "2",
"_score" : 0.30685282
} ]
}
}
curl -XPUT 'http://localhost:9200/testing/testa/1' -d '{"field1":"testa_field1","field2":"testa_field2","field3":"findme"}'
curl -XPUT 'http://localhost:9200/testing/testb/2' -d '{"field1":"testb_field1","field2":"testb_field2","field3":"findme"}'
curl -XGET 'http://localhost:9200/testing/_search?q=field3:findme&fields=field1,field2&pretty=true'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment