elastic / elastic/elasticsearch-dsl-ruby

Other bucket aggregation support

Open
#24 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
18
Forks
16
PR merge metrics
No merged PRs in 30d

Description

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](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filters-aggregation.html#other-bucket)

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!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.