Skip to content

Instantly share code, notes, and snippets.

@fmpwizard
Created November 9, 2011 20:17
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 fmpwizard/1352851 to your computer and use it in GitHub Desktop.
Save fmpwizard/1352851 to your computer and use it in GitHub Desktop.
curl -X POST "http://localhost:9200/articles/_search?pretty=true" -d '
{
"query" : { "query_string" : {"query" : "T*"} },
"filter" : { "type": { "value": "article" }} ,
"facets" : {
"tags" : { "terms" : {"field" : "tags"} }
}
}
'
Returns:
{
"took" : 4,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 2,
"max_score" : 1.0,
"hits" : [ {
"_index" : "articles",
"_type" : "article",
"_id" : "2",
"_score" : 1.0, "_source" :
{
"title" : "Two"
}
}, {
"_index" : "articles",
"_type" : "article",
"_id" : "3",
"_score" : 1.0, "_source" :
{"title" : "Three"}
} ]
},
"facets" : {
"tags" : {
"_type" : "terms",
"missing" : 2,
"total" : 0,
"other" : 0,
"terms" : [ ]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment