hw2 (part 1): done ex1, ex2, ex3a-b
This commit is contained in:
parent
24d8a8c3e2
commit
92b7029703
2 changed files with 75 additions and 0 deletions
38
Assignment2_part1/queries/query3a.http
Normal file
38
Assignment2_part1/queries/query3a.http
Normal 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" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
37
Assignment2_part1/queries/query3b.http
Normal file
37
Assignment2_part1/queries/query3b.http
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue