Skip to content

Is it possible to control the order of methods when chaining multiple? #300

@teddieliljekvist

Description

@teddieliljekvist

I am trying to implement something that functions like post_filter, to be able to return aggregations not included in the filter.
When I try to build a query with query, aggregations and filter, in that order, bodybuilder re-orders the methods and generates the filter before everything else.

Is it possible to achieve this result or something that functions the same way?

{
  "query": {
    "match": {
      "rvcategory": "kilim"
    }
  },
  "aggregations": {
    "agg_terms_rvcategory": {
      "terms": {
        "field": "rvcategory"
      }
    },
    "agg_terms_shape": {
      "terms": {
        "field": "shape"
      }
    }
  },
  "filter": {
    "term": {
      "shape": "rectangular"
    }
  },
  "size": 10,
  "from": 0
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions