Skip to content

Instantly share code, notes, and snippets.

@clintongormley
Created November 10, 2011 11:36
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 clintongormley/1354663 to your computer and use it in GitHub Desktop.
Save clintongormley/1354663 to your computer and use it in GitHub Desktop.
curl -XGET 'http://127.0.0.1:9200/articles/_search?pretty=1' -d '
{
"query" : {
"bool" : {
"should" : [
{
"filtered" : {
"filter" : {
"type" : {
"value" : "article"
}
},
"query" : {
"field" : {
"_all" : "t*"
}
}
}
},
{
"constant_score" : {
"filter" : {
"type" : {
"value" : "tags"
}
}
}
}
]
}
},
"filter" : {
"type" : {
"value" : "article"
}
},
"facets" : {
"tags" : {
"terms" : {
"field" : "tags"
}
}
}
}
'
# [Thu Nov 10 12:35:30 2011] Response:
# {
# "hits" : {
# "hits" : [
# {
# "_source" : {
# "title" : "Two"
# },
# "_score" : 0.35355338,
# "_index" : "articles",
# "_id" : "2",
# "_type" : "article"
# },
# {
# "_source" : {
# "title" : "Three"
# },
# "_score" : 0.35355338,
# "_index" : "articles",
# "_id" : "3",
# "_type" : "article"
# }
# ],
# "max_score" : 0.35355338,
# "total" : 2
# },
# "timed_out" : false,
# "_shards" : {
# "failed" : 0,
# "successful" : 5,
# "total" : 5
# },
# "facets" : {
# "tags" : {
# "other" : 0,
# "terms" : [
# {
# "count" : 2,
# "term" : "foo"
# },
# {
# "count" : 1,
# "term" : "bar"
# }
# ],
# "missing" : 2,
# "_type" : "terms",
# "total" : 3
# }
# },
# "took" : 2
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment