Use static data as a "pseudo-aggregation" in Elasticsearch query?


(Marc Zahn) #1

Hi,

I have a quite simple question: Since I need some data in an aggregation for filtering documents I need some static data that I can use for comparing to other values. Somehow like this:

...
"group_by_sth": {
    "terms": ...group by sth...
},
"aggs": {
    "filter_sth": {
       "bucket_selector": {
          "buckets_path": {
             "std_upper": "stats.std_upper",
             "static_value": "my_static_data.id_sth"
          },
          "script": "params.question_avg < params.std_upper"
       }
    },
    "my_static_data": {
      "<some agg which contains static data>": {
        "id1": {...},
        "id2": {...},
        ...
      }
    },
...

where sth_id is the id of the document which is group by sth. The background is that the data which is static is not available in this aggregation.


(system) closed #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.