Skip to content

Instantly share code, notes, and snippets.

@clintongormley
Created July 18, 2011 10:58
Show Gist options
  • Save clintongormley/1089180 to your computer and use it in GitHub Desktop.
Save clintongormley/1089180 to your computer and use it in GitHub Desktop.
Example name query
curl -XGET 'http://127.0.0.1:9200/test/member/_search?pretty=1' -d '
{
"query" : {
"bool" : {
"should" : [
{
"text" : {
"first_name" : {
"boost" : 1,
"query" : "rob smith"
}
}
},
{
"text" : {
"first_name.partial" : "rob smith"
}
},
{
"text" : {
"first_name.metaphone" : "rob smith"
}
},
{
"text" : {
"last_name" : {
"boost" : 1,
"query" : "rob smith"
}
}
},
{
"text" : {
"last_name.partial" : "rob smith"
}
},
{
"text" : {
"last_name.metaphone" : "rob smith"
}
}
]
}
}
}
'
# [Mon Jul 18 12:57:56 2011] Response:
# {
# "hits" : {
# "hits" : [
# {
# "_source" : {
# "location" : [
# 51.50853,
# -0.12574
# ],
# "member_id" : "ABC-1234",
# "birthday" : "1970-10-24",
# "first_name" : "Robert",
# "last_name" : "Smith"
# },
# "_score" : 0.030499782,
# "_index" : "test",
# "_id" : "KAz-s1E1SL-pZx1N7sYFqA",
# "_type" : "member"
# },
# {
# "_source" : {
# "location" : [
# 53.41667,
# -2.25
# ],
# "member_id" : "ABC-1235",
# "birthday" : "1975-11-03",
# "first_name" : "Robin",
# "last_name" : "Jones"
# },
# "_score" : 0.0010306468,
# "_index" : "test",
# "_id" : "QSirGFKUQVic3Pthyc7jDw",
# "_type" : "member"
# }
# ],
# "max_score" : 0.030499782,
# "total" : 2
# },
# "timed_out" : false,
# "_shards" : {
# "failed" : 0,
# "successful" : 5,
# "total" : 5
# },
# "took" : 5
# }
@sauravGit
Copy link

Does this one supports ES 1.7.1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment