Skip to content

Instantly share code, notes, and snippets.

@alh3im
Created March 14, 2011 16:55
Show Gist options
  • Save alh3im/869446 to your computer and use it in GitHub Desktop.
Save alh3im/869446 to your computer and use it in GitHub Desktop.
curl -XGET http://localhost:9200/devalexbk10/usr/_search?pretty=true -d '
{
"query":{
"filtered":{
"query":{
"query_string":{
"default_field":"title",
"default_operator":"AND",
"query":"John"
}
},
"filter":{
"or":[{"term":{"locations":1}},{"term":{"locations":2}}]
},
"highlight":{
"fields":{"title":{"fragment_size":150,"number_of_fragments":3}}
}
}
}
}'
//Result
{
"took" : 56,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "devalexbk10",
"_type" : "usr",
"_id" : "2741",
"_score" : 1.0,
"_source" : {
"id":2741,
"title":"John Doe",
"creationDate":"2011-02-23 13:44:14",
"login":"jdoe@localhost.com",
"firstName":"John",
"lastName":"Doe",
"locations":["1864","2","1597","1598"]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment