Index: product_test 1. Query all GET /_search { “query”: { “match_all”: {} } } 2. Query by index GET product_test/_search { “query”: { “match_all”: {} } } 3. Like. ‘5%’ GET product_test/_search { “query”: { “bool”: { “filter”: [ { “prefix”: { “name”: “name_5” }} ] } } } 4. Like. ‘5%1’ GET product_test/_search { “query”: { “bool”: { “filter”: [ { “wildcard”: { “name”: “name_5*1” }} ] } } } 5. Query and group by POST /product_test/_search { “query”: { “match_all”: {} }, “aggregations”: { “category”: { “terms”: { “field”: “category” } } } }
curl -XPOST “http://localhost:9200/{index}/product/_search" -H ‘Content-Type: application/json’ -d’ { “from”: 0, “size”: 20, “aggregations”: { “category_id”: { “terms”: { “field”: “category_id” } } } }’