Query Types in Elastic 5
Returns all content with a score of 1.0
POST /index_name/_search
{
"query" : {
"match_all" : {...}
}
}
Used for searching bodies of text
POST /index_name/_search
{
"query" : {
"match" : {
"name" : "John"
}
}
}
POST /index_name/_search
{
"query" : {
"multi_match" : {
"name" : "John",
"fields" : ["city", "state"]
}
}
}
Designed to be used with structured data
POST /index_name/_search
{
"query" : {
"exists" : {
"field" : "user"
}
}
}
Match doc based on mapping type.
POST /index_name/_search
{
"query" : {
"type" : {
"value" : "type_name"
}
}
}
POST /index_name/_search
{
"query" : {
"range" : {
"rating" : {
"gte" : 4
}
}
}
}