0

Is it possible to filter for specific terms? For example, I have an index with items (item 1, item 2, item 3, etc) and each item has a value (value 1, value 2, value 3, etc).

What I want to do is for each item, retrieve a specific value and do aggregations on those values.

For example, the user would like to know the average values for item 1 with value 1 and value 2, for item 2 with value 2 and value 4, for item 3 with value 1 and value 6, etc.

One item can have multiple values and one value can have multiple items. A user can have more than 10 thousand items and each item can have over a hundred values.

"size": 0,
        "aggs": {
            "per_term": {
                "terms": {
                    "field": "item",
                    "size": 10000
                },
                "aggs": {
                            "avg_value": {
                                "avg": {
                                    "field": "value"
                                }
                            }
                    }
                }
            }
        }
    }

I know it's possible to calculate the average per item, but can I filter values per specific item?

Mathijs
  • 177
  • 3
  • 18

0 Answers0