hw2 (part 1): done ex1, ex2, ex3a-b

This commit is contained in:
Claudio Maggioni 2023-04-24 12:09:43 +02:00
parent 24d8a8c3e2
commit 92b7029703
2 changed files with 75 additions and 0 deletions

View file

@ -0,0 +1,38 @@
GET /restaurants/_search
{
"size": 0,
"query": {
"bool": {
"must": [
{
"match": {
"ratingText": "Good"
}
}
]
}
},
"aggs": {
"votes_ranges": {
"range": {
"field": "votes",
"ranges": [
{ "from": 0, "to": 250 },
{ "from": 250, "to": 500 },
{ "from": 500, "to": 750 },
{ "from": 750, "to": 1000 }
]
},
"aggs": {
"min_cost": {
"min": {
"field": "averageCostForTwo"
}
},
"max_cost": {
"max": { "field": "averageCostForTwo" }
}
}
}
}
}

View file

@ -0,0 +1,37 @@
GET /restaurants/_search
{
"size": 0,
"query": {
"range": {
"votes": {
"gte": 100
}
}
},
"aggs": {
"city_term": {
"terms": {
"field": "city.keyword",
"size": 10000,
"shard_size": 10000,
"min_doc_count": 10,
"order": { "_count": "desc" }
},
"aggs": {
"avg_price": {
"avg": {
"field": "averageCostForTwo"
}
},
"avg_price_bucket_sort": {
"bucket_sort": {
"sort": [
{ "avg_price": { "order": "desc" } }
],
"size": 7
}
}
}
}
}
}