Commit graph

182 commits

Author SHA1 Message Date
Luigi Dell'Aquila
aa87f46681
Optimize date rounding (#128687) 2025-06-10 10:56:56 +02:00
Iván Cea Fontenla
36828e2f72
Aggs: Fix significant terms not finding background documents for nested fields (#128472)
Closes https://github.com/elastic/elasticsearch/issues/101163

Fixes the `significant_terms` aggregation not working correctly on nested fields.
2025-06-04 15:54:35 +03:00
Nik Everett
da553b11e3
Fix a bug in significant_terms (#127975)
Fix a bug in the `significant_terms` agg where the "subsetSize" array is
too small because we never collect the ordinal for the agg "above" it.

This mostly hits when the you do a `range` agg containing a
`significant_terms` AND you only collect the first few ranges. `range`
isn't particularly popular, but `date_histogram` is super popular and it
rewrites into a `range` pretty commonly - so that's likely what's really
hitting this - a `date_histogram` followed by a `significant_text` where
the matches are all early in the date range held by the shard.
2025-05-09 13:48:19 -04:00
Armin Braun
f461f90d48
Remove redundant marker interfaces that extend Bucket (#127038)
No need to have these marker interfaces around when weäre not using them anywhere, all they do is hide a lot of code duplication actually. Removing them sets up the possible removal of hundreds of lines of downstream code it seems
2025-04-18 18:26:39 +02:00
Ignacio Vera
aba54e8af8
Don't generate stacktrace in TaskCancelledException (#125002) 2025-03-17 15:59:08 +01:00
Ignacio Vera
6036a1ef00
Build list of the right length in #finalizeSampling (#124762)
Avoid oversize list in internal aggregations.
2025-03-13 17:14:20 +01:00
Rene Groeschke
496c38e5a5
Reapply "Update Gradle wrapper to 8.13 (#122421)" (#123889) (#123896)
This reverts commit 36660f2e5f.
2025-03-05 08:02:13 +01:00
Rene Groeschke
36660f2e5f
Revert "Update Gradle wrapper to 8.13 (#122421)" (#123889)
This reverts commit e19b2264af.
2025-03-03 15:51:07 +01:00
Rene Groeschke
e19b2264af
Update Gradle wrapper to 8.13 (#122421)
* Fix Gradle Deprecation warning as declaring an is- property with a Boolean type has been deprecated.
* Make use of new layout.settingsFolder api to address some cross project references
* Fix buildParams snapshot check for multiprojet projects
2025-03-03 14:10:00 +01:00
Mark Tozzi
69b2078723
Aggregations cancellation after collection (#120944)
This PR addresses issues around aggregations cancellation, mentioned in https://github.com/elastic/elasticsearch/issues/108701 and other places. In brief, during aggregations collection time, we respect cancellation via the mechanisms in the searcher to poison cancelled queries. But once the aggregation finishes collection, there is no further need to interact with the searcher, so we cannot rely on that for cancellation checking. In particular, deeply nested aggregations can spend a long time constructing the results tree.

Checking for cancellation is a trade off, as the check itself is somewhat expensive (it involves a volatile read), so we want to balance checking often enough that cancelled queries aren't taking up resources for a long time, but not so frequently that it slows down most aggregation queries. Our first attempt to this is to check once when we go to build sub-aggregations, as the worst cases for this that we've seen involve needing to build deep sub-aggregation trees. Checking at sub-aggregation construction time also provides a conveniently centralized method call to add the check to.

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: Nik Everett <nik9000@gmail.com>
2025-02-06 17:15:01 +01:00
Armin Braun
453db3fd71
Optimize InternalAggregations construction a little (#120868)
We can streamline and optimize this logic a little to
see less copying and more compact results.
2025-01-28 11:50:47 +01:00
Matteo Piergiovanni
5f9efb5e85
fix testCancellationDuringTimeSeriesAggregation (#119925) 2025-01-10 11:48:02 +01:00
Rene Groeschke
ba61f8c7f7
Update Gradle wrapper to 8.12 (#118683)
This updates the gradle wrapper to 8.12

We addressed deprecation warnings due to the update that includes:

- Fix change in TestOutputEvent api
- Fix deprecation in groovy syntax
- Use latest ospackage plugin containing our fix
- Remove project usages at execution time
- Fix deprecated project references in repository-old-versions
2024-12-30 15:34:24 +01:00
Armin Braun
91835ecffa
Run assertAcked(...) requests in parallel in some spots (#118980)
Similar to how we sped up search tests we can parallelize a lot on
`assertAcked` calls when those aren't logically dependant on one another.
This speeds up tests quite a bit in some cases by avoiding unbatched CS updates
or at least allowing for more parallelism.
Also, this gives a bit more coverage as far as stressing the system with concurrent
transport requests goes.
2024-12-19 20:17:55 +01:00
Matteo Piergiovanni
97bc2919ff
Prevent data nodes from sending stack traces to coordinator when error_trace=false (#118266)
* first iterations

* added tests

* Update docs/changelog/118266.yaml

* constant for error_trace and typos

* centralized putHeader

* moved threadContext to parent class

* uses NodeClient.threadpool

* updated async tests to retrieve final result

* moved test to avoid starting up a node

* added transport version to avoid sending useless bytes

* more async tests
2024-12-18 15:29:35 +01:00
Quentin Deschamps
908cf9ab76
Fix moving function linear weighted avg (#118516)
Fix moving function linear weighted avg
2024-12-13 14:54:48 -05:00
Simon Cooper
77590834e4
Remove references to transport versions 7.3 and 7.4 (#118289) 2024-12-10 14:57:20 +00:00
Ignacio Vera
78400b8d05
InternalMultiBucketAggregation.InternalBucket does not implement writable anymore (#117310)
This allows to make some Bucket implementations leaner, in particular terms and multi-terms aggregations
2024-11-26 07:53:40 +01:00
Rene Groeschke
f6ac6e1c3b
[Build] Remove deprecated BuildParams (#116984) 2024-11-22 16:30:57 +01:00
Ignacio Vera
8cfe8f1c5c
MultiBucketsAggregation.Bucket does not implement ToXContent anymore (#117240)
This change makes some buckets implementation leaner.
2024-11-22 07:13:44 +01:00
Ignacio Vera
75f4232274
Check the real memory circuit breaker when building internal aggregations (#117019)
checks periodically the real memory circuit breaker when allocating objects.
2024-11-21 12:44:17 +01:00
Jan Kuipers
dea1e7dfa7
Propagate scoring function through random sampler (#116957)
* Propagate scoring function through random sampler.

* Update docs/changelog/116957.yaml

* Correct score mode in random sampler weight

* Fix random sampling with scores and p=1.0

* Unit test with scores

* YAML test

* Add capability
2024-11-20 15:34:19 +01:00
Ignacio Vera
9296fb40ff
Use LongArray instead of long[] for owning ordinals when building Internal aggregations (#116874)
This commit changes the signature of InternalAggregation#buildAggregations(long[]) to
InternalAggregation#buildAggregations(LongArray) to avoid allocations of humongous arrays.
2024-11-19 12:26:37 +01:00
Rene Groeschke
13c8aaeffa
[Gradle] Remove static use of BuildParams (#115122)
Static fields dont do well in Gradle with configuration cache enabled.

- Use buildParams extension in build scripts
- Keep BuildParams.ci for now for easy serverless migration
-  Tweak testing doc
2024-11-15 17:58:57 +01:00
Kostas Krikellas
2054357902
Refactor DocumentDimensions to RoutingFields (#116321)
* Refactor DocumentDimensions to RoutingFields

* update

* add test

* add test

* updates from review

* updates from review

* spotless

* remove final from subclass

* fix final
2024-11-11 18:04:09 +02:00
Ignacio Vera
c253a14be8
Handle with illegalArgumentExceptions negative values in HDR percentile aggregations (#116174)
This commit changes to an illegalArgumentException which translate in a bad request (400).
2024-11-05 15:31:08 +01:00
Kostas Krikellas
4573ab8ec1
[TEST] Replace _source.mode with index.mapping.source.mode in integration tests - take 2 (#116072)
* Reapply "[TEST] Replace _source.mode with index.mapping.source.mode in integra…" (#116069)

This reverts commit e8bf344a28.

* [TEST] Replace _source.mode with index.mapping.source.mode in integration tests

* add reason

* add reason

* spotless

* revert unneeded
2024-11-04 09:39:34 +02:00
Kostas Krikellas
e8bf344a28
Revert "[TEST] Replace _source.mode with index.mapping.source.mode in integra…" (#116069)
This reverts commit a360757968.
2024-11-01 10:53:08 +02:00
Kostas Krikellas
a360757968
[TEST] Replace _source.mode with index.mapping.source.mode in integration tests (#115926)
* Replace _source.mode with index.mapping.source.mode in integration tests

* fix tests

* revert 40_source_mode_setting.yml
2024-11-01 09:46:06 +02:00
David Turner
b0aa39fa67
Simplify XContent output of epoch times (#114491)
Today the overloads of `XContentBuilder#timeField` do two rather
different things: one formats an object as a `String` representation of
a time (where the object is either an unambiguous time object or else a
`long`) and the other formats only a `long` as one or two fields
depending on the `?human` flag.

This is trappy in a number of ways:

- `long` means an absolute (epoch) time, but sometimes folks will
  mistakenly use this for time intervals too.

- `long` means only milliseconds, there is no facility to specify a
  different unit.

- the dependence on the `?human` flag in exactly one of the overloads is
  kinda weird.

This commit removes the confusion by dropping support for considering a
`Long` as a valid representation of a time at all, and instead requiring
callers to either convert it into a proper time object or else call a
method that is explicitly expecting an epoch time in milliseconds.
2024-10-15 02:32:29 +11:00
Oleksandr Kolomiiets
a62228a744
Allow stored source in logsdb and tsdb (#114454) 2024-10-11 11:16:55 -07:00
Ignacio Vera
19d7028631
Run fail formatting yaml test with 1 shard (#114214) 2024-10-08 20:44:24 +02:00
Simon Cooper
86f21d190c
Fix stats test that checks for formatter tostring (#114215)
Locale may or may not be there depending on version
2024-10-07 13:01:10 +01:00
Simon Cooper
4ef5ea6d1c
Change default locale of date mappers to ENGLISH (#112799)
English is not changing between COMPAT and CLDR locale databases, whereas ROOT is
2024-10-07 10:22:38 +01:00
Simon Cooper
f9aa6f40cd
Always use CLDR locale on ES v9 (#113184)
Regardless of JDK version, ES should always use CLDR locale database from 9.0.0.
This also removes IsoCalendarDataProvider used to override week-date calculations for the root locale only.
2024-09-23 11:05:08 +01:00
Mark Vieira
a59c182f9f
Add AGPLv3 as a supported license 2024-09-13 15:29:46 -07:00
Mark Vieira
4ce661cc48
Bump Elasticsearch version to 9.0.0 (#112570) 2024-09-11 09:40:11 -07:00
Mark Vieira
24f33e95e8
Ensure rest compatibility tests are run when appropriate (#112526) 2024-09-05 08:22:48 -07:00
Armin Braun
bf7be8e23a
Save 400 LoC in tests by using indexSettings shortcut (#111573)
It's in the title, randomly saw a bunch of spots where we're
not using the shortcut, figured I'd clean this up quickly to save ~400 lines.
2024-08-05 10:21:13 +02:00
Simon Cooper
32c21beb3f
Collapse transport versions for 8.14.0 (#111199) 2024-07-24 10:40:35 +01:00
Armin Braun
10e2cc3c11
Dry up Bucket types in o.e.search.aggregations.bucket.histogram (#110303)
It's in the title, lots of duplication here that deserves cleanup
in isolation. Also, bucket instances are a perpetual source of
memory consuption in aggs. There are lots of possible improvements
we can make to reduce their footprint, drying up this code enables
cleaner PRs for these improvements.
2024-07-01 15:10:02 +02:00
Alexander Spies
2876e059f3
Aggs: Improve scripted metric agg allow list tests (#110153)
* Add an override to the aggs tests to override the allow list default setting. This makes it possible to run the scripted metric aggs tests on Serverless, even when we disallow these aggs per default on Serverless.
* Move the allow list tests next to the scripted metric tests since these belong together.
2024-06-28 11:47:30 +02:00
Armin Braun
c856314ea2
Make empty aggregation instances a little cheaper (#110190)
For sub-aggregations we were not properly sizing the array. Also we can
use singleton lists in a couple spots to save a little more memory.
2024-06-27 00:51:29 +10:00
Martijn van Groningen
ac6c0eecc1
Ensure synthetic source and dv codec are enabled with logs index mode (attempt 2). (#109382)
This was initially muted via #109365, because of a failing newly introduced assert.

Original PR #109269
2024-06-05 17:32:14 +02:00
Oleksandr Kolomiiets
f1153b1f8d
Revert "Ensure synthetic source and dv codec are enabled with logs index mode. (#109269)" (#109365)
This reverts commit 4161e4d2e2.
2024-06-04 12:45:08 -07:00
Martijn van Groningen
4161e4d2e2
Ensure synthetic source and dv codec are enabled with logs index mode. (#109269)
After running the elastic/logs track with logs index mode enabled, I noticed that _source was still getting stored.
The issue was that other index modes than time_series weren't propagated to Indexmetadata and IndexSettings classes. Additionally the synthetic source defaults in SourceFieldMapper were geared towards time series index mode only. This change addresses this.
2024-06-04 16:06:19 +02:00
Moritz Mack
b71fc0c561
Migrate remaining usage of skip version in YAML specs to cluster_features (#108055) 2024-05-07 09:42:17 +02:00
Ignacio Vera
eea94ae66f
Optimise histogram aggregations for single value fields (#107893)
This commit optimise histogram aggregations for single value fields.
2024-05-02 07:30:55 +02:00
eyalkoren
ee262954ee
Adding aggregations support for the _ignored field (#101373)
Enables aggregations on the _ignored metadata field replacing the stored field
with doc values.
2024-04-29 16:41:34 +02:00
Simon Cooper
f53f06ea88
Define transport version constant for 8.13 (#107951) 2024-04-29 09:53:51 +01:00