I'm very new to Elasticsearch and currently trying to translate a MySQL query into Elasticsearch one. The documents are stored under "Json_logs" index in ES.
Document:
{
"bid_id": "16613393",
"user_id": "f63edcf2-e353-4c50-8a6e-290f973b320e",
"date": "2016-01-03",
"timestamp1": 1451861391,
"timestamp2": null,
"zone": {
"zone_id": 124519,
"tag_type": null,
"in_iframe": null,
"document_referrer": "http%3A%2F%2Fwww.celebritynetworth.com%2Frichest-celebrities%2Fsingers%2Fmichael-jackson-net-worth%2F",
"cost": 0.4,
"parent_zone_id": null
},
"device": {
"ip": "174.52.96.91",
"ua": "Mozilla/5.0 (iPad; CPU OS 9_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13C75 Safari/601.1",
"device_code": 5,
"device_type": "Tablet"
},
"bid": {
"page_url": null,
"floor_price": 0.3,
"buyers": []
},
"impression": {
"buyer_id": null,
"win_price": 0.3,
"banner_id": 1029526
}
}
MySQL query:
SELECT SUM(floor_price)
FROM Json_logs
WHERE zone_id=124519 AND floor_price=0.2
GROUP BY zone_id;
What would be the equivalent query in Elasticsearch for the above MySQL query? Thank you!
WHERE zone_id=124519 AND floor_price=0.2isn'tGROUP BY zone_idredundant ?