Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@clintongormley
Created March 21, 2013 17:41
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/5215015 to your computer and use it in GitHub Desktop.
Save clintongormley/5215015 to your computer and use it in GitHub Desktop.
curl -XGET 'http://127.0.0.1:9200/events/event/_search?pretty=1' -d '
{
"sort" : {
"tags.weight" : {
"order" : "desc",
"mode" : "sum"
}
},
"query" : {
"nested" : {
"query" : {
"constant_score" : {
"filter" : {
"bool" : {
"must" : [
{
"term" : {
"tags.type" : "company"
}
},
{
"term" : {
"tags.value" : "Google"
}
}
]
}
}
}
},
"path" : "tags"
}
}
}
'
# {
# "hits" : {
# "hits" : [
# {
# "_source" : {
# "title" : "Paris in the springtime",
# "tags" : [
# {
# "value" : "Paris",
# "weight" : 10,
# "type" : "place"
# },
# {
# "value" : "Eric Schmidt",
# "weight" : 100,
# "type" : "speaker"
# },
# {
# "value" : "Google",
# "weight" : 50,
# "type" : "company"
# }
# ]
# },
# "sort" : [
# 160
# ],
# "_score" : null,
# "_index" : "events",
# "_id" : "q8iOOADTTNSkapd5_zuUuA",
# "_type" : "event"
# }
# ],
# "max_score" : null,
# "total" : 1
# },
# "timed_out" : false,
# "_shards" : {
# "failed" : 0,
# "successful" : 5,
# "total" : 5
# },
# "took" : 4
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment