query_string query to create a complex search that includes wildcard characters searches across multiple fields
This query uses syntax to parse and split the provided query string based on operators, such as AND or NOT
Sample Queries:
GET /_search
{
"query": {
"query_string": {
"query": "(new york city) OR (big apple)",
"default_field": "content"
}
}
}
GET /_search
{
"size": 10,
"sort": [
{
"date": {
"order": "desc"
}
}
],
"query": {
"query_string": {
"query": "(IP:\"\" AND URI:*API*)"
}
}
}
Match
GET /_search
{
"query": {
"match" : {
"URI" : "/index.html"
}
},
"size": 10,
"sort": [
{
"date": {
"order": "desc"
}
}
]
}
Term
GET /_search
{
"size": 10000,
"sort": [
{ "date": "desc" }
],
"query": {
"bool": {
"must" : [
{
"term": {
"name": "Bob"
}
},
{
"term": {
"gender": "male"
}
}
]
}
}
}
No comments:
Post a Comment