Hi,
as in this thread, my problem is pretty similar:
I have a product index with a nested sales_per_day
array. It looks something like this:
PUT /products
{
"mappings": {
"properties": {
"sales_per_day" : {
"type": "nested"
}
}
}
}
This is an example doc:
GET /products/_search
{
"took": 838,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 1.0,
"hits": [
{
"_index": "products",
"_type": "_doc",
"_id": "rXFCUnMBxSMm9fNU3xFV",
"_score": 1.0,
"_source": {
"revenue_per_day": [],
"id": 123456789,
"customer_id": 123456,
"sku": "some sku",
"title": "some product title",
"sales_per_day": [
{
"date": "2020-05-10",
"sales": 3
},
{
"date": "2020-05-11",
"sales": 1
}
],
"column100": "foobar"
}
}
]
}
}
What i want to display to the user is:
- the summed sales in a query-defined time-period
- filter by those sales (sales > 5, sales = 0, sales = 10, etc.)
- sort by those sales
- filter other columns at the same time
- retrieve the whole matched document
Is this possible & if so, how?