jay_api 29.3.1 → 29.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 03ef39a19b2ff79bf0aea18958f4c0ea7d2b77f87f502c85fbaa793dc191af29
|
|
4
|
+
data.tar.gz: 5abb8d21871415133f2d95cab6090b2ee8d224d7056349dbf2b667873d3ea257
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aceb3ee3bc16cee43009c8c48e079f31eed730be5ae560c1974d660dd5ac4a385648cb329a9ef9d191f0ae2358915fd311fe0d81a1ddcd5ecac8ac806ae7a17d
|
|
7
|
+
data.tar.gz: cf762fbc558af858e560a83b4bcbc57574ac9ab0ffecb7fdbebb51254008550079a4f36beec32e19ea7b58e4187ae69f06e4e1c48e8ff1aae5835691e12b6072
|
data/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,14 @@ Please mark backwards incompatible changes with an exclamation mark at the start
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [29.4.0] - 2026-01-28
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- Support for the `bucket_selector` pipeline aggregation in
|
|
15
|
+
`Elasticsearch::QueryBuilder::Aggregations`. This allows filtering
|
|
16
|
+
buckets based on computed metrics (e.g., filtering terms buckets by
|
|
17
|
+
aggregated values).
|
|
18
|
+
|
|
11
19
|
## [29.3.1] - 2025-12-15
|
|
12
20
|
|
|
13
21
|
### Fixed
|
|
@@ -35,7 +43,7 @@ Please mark backwards incompatible changes with an exclamation mark at the start
|
|
|
35
43
|
allows boolean clauses to be nested.
|
|
36
44
|
- `QueryBuilder#sort` can now receive either the direction of the sorting (`asc`
|
|
37
45
|
or `desc`) or a `Hash` with advanced sorting options. These are relayed
|
|
38
|
-
directly to Elasticsearch.
|
|
46
|
+
directly to Elasticsearch.
|
|
39
47
|
|
|
40
48
|
## [29.0.0] - 2025-08-28
|
|
41
49
|
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'aggregation'
|
|
4
|
+
|
|
5
|
+
module JayAPI
|
|
6
|
+
module Elasticsearch
|
|
7
|
+
class QueryBuilder
|
|
8
|
+
class Aggregations
|
|
9
|
+
# Represents a +bucket_selector+ pipeline aggregation in Elasticsearch.
|
|
10
|
+
# Docs:
|
|
11
|
+
# https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-selector-aggregation.html
|
|
12
|
+
class BucketSelector < ::JayAPI::Elasticsearch::QueryBuilder::Aggregations::Aggregation
|
|
13
|
+
attr_reader :buckets_path, :script, :gap_policy
|
|
14
|
+
|
|
15
|
+
# @param [String] name The name used by Elasticsearch to identify the
|
|
16
|
+
# aggregation.
|
|
17
|
+
# @param [Hash] buckets_path Path(s) to the metric or metrics
|
|
18
|
+
# over which the bucket_selector aggregation's script will operate.
|
|
19
|
+
# The keys are the names of the script variables, the values the
|
|
20
|
+
# paths to the metrics (relative to the parent aggregation).
|
|
21
|
+
# The script will receive these variables in its +params+.
|
|
22
|
+
# @param [JayAPI::Elasticsearch::QueryBuilder::Script] script
|
|
23
|
+
# Script used to decide whether to keep each bucket.
|
|
24
|
+
# @param [String, nil] gap_policy Optional gap policy (e.g. "skip",
|
|
25
|
+
# "insert_zeros").
|
|
26
|
+
def initialize(name, buckets_path:, script:, gap_policy: nil)
|
|
27
|
+
super(name)
|
|
28
|
+
|
|
29
|
+
@buckets_path = buckets_path
|
|
30
|
+
@script = script
|
|
31
|
+
@gap_policy = gap_policy
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Bucket selector is a pipeline agg and cannot have nested aggregations.
|
|
35
|
+
# @raise [JayAPI::Elasticsearch::QueryBuilder::Aggregations::Errors::AggregationsError]
|
|
36
|
+
def aggs
|
|
37
|
+
no_nested_aggregations('Bucket Selector')
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# @return [self] A copy of the receiver.
|
|
41
|
+
def clone
|
|
42
|
+
self.class.new(
|
|
43
|
+
name,
|
|
44
|
+
buckets_path: buckets_path.is_a?(Hash) ? buckets_path.dup : buckets_path,
|
|
45
|
+
script:, # Script is immutable-ish, ok to reuse
|
|
46
|
+
gap_policy:
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# @return [Hash] The Hash representation of the +Aggregation+.
|
|
51
|
+
# Properly formatted for Elasticsearch.
|
|
52
|
+
def to_h
|
|
53
|
+
super do
|
|
54
|
+
{
|
|
55
|
+
bucket_selector: {
|
|
56
|
+
buckets_path: buckets_path,
|
|
57
|
+
script: script.to_h,
|
|
58
|
+
gap_policy: gap_policy
|
|
59
|
+
}.compact
|
|
60
|
+
}
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -9,6 +9,7 @@ require_relative 'aggregations/composite'
|
|
|
9
9
|
require_relative 'aggregations/date_histogram'
|
|
10
10
|
require_relative 'aggregations/filter'
|
|
11
11
|
require_relative 'aggregations/scripted_metric'
|
|
12
|
+
require_relative 'aggregations/bucket_selector'
|
|
12
13
|
require_relative 'aggregations/sum'
|
|
13
14
|
require_relative 'aggregations/max'
|
|
14
15
|
require_relative 'aggregations/terms'
|
|
@@ -86,6 +87,16 @@ module JayAPI
|
|
|
86
87
|
)
|
|
87
88
|
end
|
|
88
89
|
|
|
90
|
+
# Adds an +bucket_selector+ type aggregation. For information about the parameters
|
|
91
|
+
# @see JayAPI::Elasticsearch::QueryBuilder::Aggregations::BucketSelector#initialize
|
|
92
|
+
def bucket_selector(name, buckets_path:, script:, gap_policy: nil)
|
|
93
|
+
add(
|
|
94
|
+
::JayAPI::Elasticsearch::QueryBuilder::Aggregations::BucketSelector.new(
|
|
95
|
+
name, buckets_path:, script:, gap_policy:
|
|
96
|
+
)
|
|
97
|
+
)
|
|
98
|
+
end
|
|
99
|
+
|
|
89
100
|
# Adds a +max+ type aggregation. For information about the parameters
|
|
90
101
|
# @see JayAPI::Elasticsearch::QueryBuilder::Aggregations::Max#initialize
|
|
91
102
|
def max(name, field:)
|
data/lib/jay_api/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jay_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 29.
|
|
4
|
+
version: 29.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Accenture-Industry X
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2026-01-28 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|
|
@@ -135,6 +135,7 @@ files:
|
|
|
135
135
|
- lib/jay_api/elasticsearch/query_builder/aggregations.rb
|
|
136
136
|
- lib/jay_api/elasticsearch/query_builder/aggregations/aggregation.rb
|
|
137
137
|
- lib/jay_api/elasticsearch/query_builder/aggregations/avg.rb
|
|
138
|
+
- lib/jay_api/elasticsearch/query_builder/aggregations/bucket_selector.rb
|
|
138
139
|
- lib/jay_api/elasticsearch/query_builder/aggregations/cardinality.rb
|
|
139
140
|
- lib/jay_api/elasticsearch/query_builder/aggregations/composite.rb
|
|
140
141
|
- lib/jay_api/elasticsearch/query_builder/aggregations/date_histogram.rb
|