GET /products/_search
{
"query": {
"term": {
"is_active": true
}
}
}
GET /products/_search
{
"query": {
"term": {
"is_active": true
"value": true
}
}
}
}
GET /products/_search
{
"query": {
"terms": {
"tags.keyword": [
"Soup",
"Cake"
]
}
}
}
GET /products/_search
{
"query": {
"ids": {
"values": ["10","11","12"]
}
}
}
GET /products/_search
{
"query": {
"range": {
"in_stock": {
"gte": 1,
"lte": 5
}
}
}
}
Range query with dates
GET /products/_search
{
"query": {
"range": {
"created": {
"gte": "2010/01/01",
"lte": "2010/12/31"
}
}
}
}
# Get Products created within last 5 Years
GET /products/_search
{
"query": {
"range": {
"created": {
"gte": "now-5y"
}
}
}
}
GET /products/_search
{
"query": {
"exists": {
"field": "tags"
}
}
}
GET /products/_search
{
"query": {
"prefix": {
"tags.keyword": {
"value": "Vege"
}
}
}
}
GET /products/_search
{
"query": {
"wildcard": {
"tags.keyword": {
"value": "Be*"
}
}
}
}
GET /products/_search
{
"query": {
"regexp": {
"tags.keyword": {
"value": "Veget[a-zA-Z]+ble"
}
}
}
}