Skip to content

Instantly share code, notes, and snippets.

@ajohnstone
Created October 7, 2012 14:21
Show Gist options
  • Save ajohnstone/3848517 to your computer and use it in GitHub Desktop.
Save ajohnstone/3848517 to your computer and use it in GitHub Desktop.
Index
andrew@andrew-OptiPlex-7010:~$ curl -s http://localhost:9200/pbx_members/Member/_mapping?pretty=true
{
"Member" : {
"properties" : {
"first_name" : {
"type" : "multi_field",
"fields" : {
"first_name" : {
"type" : "string"
},
"sort" : {
"type" : "string",
"analyzer" : "analyzer_sortable",
"include_in_all" : false
}
}
},
"last_name" : {
"type" : "multi_field",
"fields" : {
"last_name" : {
"type" : "string"
},
"sort" : {
"type" : "string",
"analyzer" : "analyzer_sortable",
"include_in_all" : false
}
}
}
}
}
}
andrew@andrew-OptiPlex-7010:~$ curl 'http://localhost:9200/pbx_members/Member/_search?pretty=true' -d '
{
"query" : {
"constant_score" : {
"filter" : {
"and" : [
{
"query" : {
"terms" : {
"last_name" : [
"Johnstone"
]
}
}
}
]
}
}
}
}
'
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}
andrew@andrew-OptiPlex-7010:~$curl 'http://localhost:9200/pbx_members/Member/_search?q=last_name:Johnstone&pretty=true'
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "pbx_members",
"_type" : "Member",
"_id" : "29752059",
"_score" : 1.0, "_source" : {"name":"Andrew Johnstone","first_name":"Andrew","last_name":"Johnstone","email":"andrew.johnstone@ajohnstone.com"}
} ]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment