Skip to content

Other bucket aggregation support #24

@anatols-baymaganov

Description

@anatols-baymaganov

hey guys, I'm trying to find a way to use other bucket with this DSL and just wonder if it's even possible or not

other bucket docs

I try this way:

aggregation "entity_tag_city" do
  filters do
    terms field: "other_entity_tag_city"
    filters terms: { directory_id: directory_ids } do
      # blah-bla-bla
    end
  end
end

[400] {"error":{"root_cause":[{"type":"parsing_exception","reason":"[directory_id] query malformed, no start_object after query name","line":1,"col":1123}],"type":"parsing_exception","reason":"[directory_id] query malformed, no start_object after query name","line":1,"col":1123},"status":400} (Elasticsearch::Transport::Transport::Errors::BadRequest)

or this way

aggregation "entity_tag_city" do
  filters "other_entity_tag" => "other_entity_tag,
            terms: { directory_id: directory_ids } do
    # blah-bla-bla
  end
end

[400] {"error":{"root_cause":[{"type":"parsing_exception","reason":"Unknown key for a VALUE_STRING in [entity_tag_city]: [other_entity_tag_city].","line":1,"col":1112}],"type":"parsing_exception","reason":"Unknown key for a VALUE_STRING in [entity_tag_city]: [other_entity_tag_city].","line":1,"col":1112},"status":400} (Elasticsearch::Transport::Transport::Errors::BadRequest)

I even tried to modify the query hash by hands and pass it to Elasticsearch::Model.search method, like this (here just part of the query hash):

"aggregation" => {
  "entity_tag_city" => {
    "filters" => {
      "filters" => {
        "terms" => { "directory_id"=>[6641, 6642, 6643] } 
      },
      "other_entity_tag_city" => "other_entity_tag_city"
    }
  }
}

which looks pretty similar to what I can see in elasticsearch docs example. But nothing helps:

Elasticsearch::Transport::Transport::Errors::BadRequest Exception: [400] {"error":{"root_cause":[{"type":"parsing_exception","reason":"[directory_id] query malformed, no start_object after query name","line":1,"col":1166}],"type":"parsing_exception","reason":"[directory_id] query malformed, no start_object after query name","line":1,"col":1166},"status":400}

so, I'm just wonder can I user other buckets with this gem and if it's so - then what is proper query syntax. Thnx!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions