Skip to content

Add hook(s) in dataset return lifecycle ToCountResult/ToFindResults to allow for customization #149

@randylsu

Description

@randylsu

Our current need is only around aggregations, so a hook into ToAggregations at the repo level would work as well, but seems like it would be nice to have something a little bit higher up in the stack as well. An example of our exact situation is ....

Field abc.def.xyz is actually mapped into a nested field with parent abc and a filter of pivotField:def, so what the user sends in as a terms aggregation terms:abc.def.xyz actually yields an Elastic agg structure of ....

"nested_abc.def.xyz": {
      "aggs": {
        "filtered_abc.def.xyz": {
          "aggs": {
            "terms_abc.def.xyz": {
              "terms": {
                "field": "search.abc.xyz"
              }
            }
          },
          "filter": {
            "term": {
              "search.abc.pivotField": {
                "value": "def"
              }
            }
          }
        }
      },
      "nested": {
        "path": "search.abc"
      }
    }

We need to roll the actual terms agg result (terms_abc.def.xyz) up 2 levels to where the consumer would have expected it without the nested trickery. Would be great to be able to do that globally at the repo level with a simple hook.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions