Commit graph

276 commits

Author SHA1 Message Date
Niels Bauman
87c6fa7e9b
Introduce projectClient method on Client (#129174)
We originally defined the `projectClient` method on `ProjectResolver` as
a convenience method to execute API calls for specific projects. That
method requires a reference to both a `ProjectResolver` and a `Client`.

We now introduce the same method directly on the `Client` interface and
inject a `ProjectResolver` there, removing the need for a
`ProjectResolver` reference in places that just want to execute API
requests on a specific project.

To reduce the number of changes, this change solely focuses on
introducing the new method. Future changes will migrate the uses of the
original method to the new one and remove the original altogether.
2025-06-12 15:19:16 -03:00
Simon Cooper
3988ee1935
Check positions on MultiPhraseQueries as well as phrase queries (#129326) 2025-06-12 16:05:07 +01:00
Ignacio Vera
ffdfcec334
Upgrade to Lucene 10.2.0 (#126594)
This commit upgrade Elasticsearch to lucene 10.2.0
2025-04-14 13:50:52 +02:00
Carlos Delgado
968bddc462
Non existing synonyms sets do not fail shard recovery (#125659) 2025-03-27 18:04:20 +02:00
Ryan Ernst
3c129e7fce
Re-enable analysis stemmer test (#124961)
This test was disabled until exclusive entitlements were added.

closes #119130
2025-03-17 02:57:36 +11:00
Benjamin Trent
a92b1d6892
Adjust exception thrown when unable to load hunspell dict (#123743)
On index creation, its possible to configure an hunspell analyzer, but
reference a locale file that actually doesn't exist or isn't accessible.

This error, like our other user dictionary errors, should be an IAE not
an ISE.

closes: https://github.com/elastic/elasticsearch/issues/123729
2025-03-06 06:19:21 +11:00
Lorenzo Dematté
20b829fc14
[Entitlements] Add check functions for NIO Files (#122591) 2025-02-19 21:55:06 +01:00
Ryan Ernst
0cf42f2388
Rename environment dir accessors (#121803)
The node environment has many paths. The accessors for these currently
use a "file" suffix, but they are always directories. This commit
renames the accessors to make it clear these paths are directories.
2025-02-05 14:03:28 -08:00
Mayya Sharipova
5a5683215e
Analyze API to return 400 for wrong custom analyzer (#121568)
If a custom analyzer provided in _analyze API can not be built, return
400 instead of the current 500. This most probably means that the user's
provided analyzer specifications are wrong.

Closes #121443
2025-02-06 07:24:13 +11:00
Dimitris Rempapis
e276c71f76
Reintroduce common-analysis tests (#120604)
Reintroduce common-analysis tests
2025-01-22 17:00:03 +02: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
e94f145350
Fix a bunch of non-final static fields (#119185)
Fixing almost all missing `final` spots, who knows maybe we get a small speedup from
some constant folding here and there.
2024-12-26 19:14:36 +01:00
Ryan Ernst
39a58e24c7
Conditionally mute synonyms config access test (#119140)
This synonyms test checks certain config files cannot be accessed. It
relies on security manager, which is not enabled in JDK 24. Until the
entitlement based replacement is available, this commit mutes the test.

see #119130
2024-12-19 21:48:02 +00:00
Armin Braun
97a3540496
Remove unused deprecation loggers (#119129)
It's in the title, just noticed a bunch of these have become unused over time.
2024-12-19 20:40:29 +01:00
Luca Cavanna
f760b40815
Broaden index versions tested to cover v7 versions for some analysis tests (#119024)
This replaces usages of MINIMUM_COMPATIBLE with MINIMUM_READONLY_COMPATIBLE as a
lower bound when randomizing the index version in some tests. This provides more
coverage as it relies on readonly versions as opposed to only those that can be
written to.
2024-12-19 09:54:41 +01:00
Christoph Büscher
c98ca63b46
Revert 7.x related code from analysis common (#118972)
This reverts #113009 and re-introduces v7 compatibility logic and previous v7 tests
since we now support v7 indices as read-only on v9.
2024-12-19 00:09:37 +01:00
Luca Cavanna
ede1a7ab2a
Include v7 in IndexVersionUtils#ALL_VERSIONS (#118793)
We are going to retain read-only compatibility with v7 index versions upon upgrade to v9. This means that all the v7 index versions and corresponding version conditionals will stay around for another major series.

This PR reflects this decision in the codebase. No need to filter index versions when retrieving ALL_VERSIONS, and we can remove corresponding @UpdateForV9 annotations from the IndexVersions class. At the same time, there are tests that need to randomize version but need to write to an index, hence 7x versions should be filtered out.

The overall goal is to extend testing to v7 index versions when possible, and making randomization across writeable versions an exception that certain tests can rely on as needed.

These are the mechanical steps I made in this PR:

- Rename `getFirstVersion` to `getLowestReadCompatibleVersion`, which returns the lowest supported index version ( which can not be written to)
- Introduce `getLowestWriteCompatibleVersion` to identify the lowest writeable version. This is used by tests that used to call `getFirstVersion` and need to write to the index.
- Remove `randomVersion(Random random)` in favour of `randomVersion()` . It was always called providing `random()` which is equivalent to what `randomVersion()` already does.
- Introduce `randomWriteVersion` for tests that need a random writeable version. Moved tests that need it to use it (from `randomVersion` to `randomWriteVersion`)

There is still work to do in `IndexVersionUtils` to extend testing, especially as some randomized tests have a lower bound of `MINIMUM_COMPATIBLE_VERSION` hence don't include v7 index versions yet. We will address that as a follow-up.
2024-12-18 13:46:21 +01:00
Benjamin Trent
d614804731
Remove analyzer version deprecation check (#118167)
Version has been deprecated since v7:
https://github.com/elastic/elasticsearch/pull/74073

Removing checking for the version setting. It has been ignored and does
nothing for the entirety of 8 and for the last minors of v7.
2024-12-10 07:30:14 +11:00
Benjamin Trent
e55f07b850
Remove long deprecated ignore_case from synonym filter (#115985)
ignore_case has been deprecated in synonym filter since ES 6.
2024-12-07 02:05:17 +11:00
Peter Straßer
c804953105
Provide access to new settings for HyphenationCompoundWordTokenFilter (#115585)
Allow the new flags added in Lucene in the HyphenationCompoundWordTokenFilter

Adds access to the two new flags no_sub_matches and no_overlapping_matches.

Lucene issue: https://github.com/apache/lucene/issues/9231
2024-11-18 17:38:49 +01:00
Luca Cavanna
8efd08b019
Upgrade to Lucene 10 (#114741)
The most relevant ES changes that upgrading to Lucene 10 requires are:

- use the appropriate IOContext
- Scorer / ScorerSupplier breaking changes
- Regex automaton are no longer determinized by default
- minimize moved to test classes
- introduce Elasticsearch900Codec
- adjust slicing code according to the added support for intra-segment concurrency
- disable intra-segment concurrency in tests
- adjust accessor methods for many Lucene classes that became a record
- adapt to breaking changes in the analysis area

Co-authored-by: Christoph Büscher <christophbuescher@posteo.de>
Co-authored-by: Mayya Sharipova <mayya.sharipova@elastic.co>
Co-authored-by: ChrisHegarty <chegar999@gmail.com>
Co-authored-by: Brian Seeders <brian.seeders@elastic.co>
Co-authored-by: Armin Braun <me@obrown.io>
Co-authored-by: Panagiotis Bailis <pmpailis@gmail.com>
Co-authored-by: Benjamin Trent <4357155+benwtrent@users.noreply.github.com>
2024-10-21 13:38:23 +02:00
Benjamin Trent
5c840f72b7
Deprecate dutch_kp and lovins stemmer as they are removed in Lucene 10 (#113143)
Lucene 10 has upgraded its Snowball stemming support, as part of those
upgrades, two no longer supported stemmers were removed, `KpStemmer` and
`LovinsStemmer`. These are `dutch_kp` and `lovins`, respectively.

We will deprecate in 8.16 and will remove support for these in a future
version.
2024-10-01 04:03:44 +10:00
Benjamin Trent
986cb020b2
Add assertWarnings capabilities to base token stream test case (#113619)
We need to be able to assert various warnings and check for such in
typical token stream tests. This adds that capability.
2024-09-27 23:15:01 +10:00
Luca Cavanna
ef37511f0a
Remove deprecations and 7.x related code from analysis common (#113009)
edgeNGram and NGram tokenizers and token filters were deprecated. They have not been supported in indices created from 8.0,
hence their support can entirely be removed from main.

The version related logic around the min grams can also be removed as it refers to 7.x which we no longer need to support.

Relates to #50376, #50862, #43568
2024-09-18 09:03:08 +02:00
Mark Vieira
a59c182f9f
Add AGPLv3 as a supported license 2024-09-13 15:29:46 -07:00
Quentin Pradet
d18fc4c563
Remove unused parameter in char filter YAML test (#112852) 2024-09-13 12:50:23 +04:00
Mark Vieira
4ce661cc48
Bump Elasticsearch version to 9.0.0 (#112570) 2024-09-11 09:40:11 -07:00
Quentin Pradet
707187d220
Extract deprecated PathHierarchy to own YAML test (#112647) 2024-09-09 18:27:36 +04:00
Quentin Pradet
ba8590ba13
Add analysis-common YAML tests to rest-resources-zip (#111974) 2024-08-19 18:57:39 +04:00
Mike Pellegrini
e11fa74333
Gracefully handle invalid synonym rules in updateable synonyms (#110901)
Gracefully handle invalid synonym rules by setting lenient to true by default when synonyms are updateable

---------

Co-authored-by: carlosdelest <carlos.delgado@elastic.co>
2024-08-06 10:44:23 -04:00
Benjamin Trent
14bce355e5
Actually deprecate edge_ngram side parameter (#110829)
this parameter has been "deprecated" for a while, but no action was
actually taken. This actually deprecates the value for future removal.
2024-07-17 03:51:27 +10:00
Benjamin Trent
d97cb686a5
Correct positioning for unique token filter (#109395)
This is an extension of:
https://github.com/elastic/elasticsearch/pull/35420

closes: https://github.com/elastic/elasticsearch/issues/35411
2024-06-22 09:44:24 +10:00
Aurélien FOUCRET
c93862f1bd
Wrap "Pattern too complex" exception into an IllegalArgumentException (#109173) 2024-05-31 18:02:54 +02:00
Simon Cooper
177dc263b3
Block specific config files from being accessed after startup (#107481)
Some files should never be accessed by ES or plugin code once startup has completed. Use the security manager to block these files from being accessed by anything at all. The current blocked files are elasticsearch.yml, jvm.options, and the jvm.options.d directory.
2024-04-29 09:58:12 +01:00
Moritz Mack
1f5e04b721
Migrate YAML REST tests to synthetic cluster feature check (#107068)
To simplify the migration away from version based skip checks in YAML specs, 
this PR adds a synthetic version feature `gte_vX.Y.Z` for any version at or before 8.14.0.

New test specs for 8.14 or later are expected to use respective new cluster features,
or a test-only feature supplied via ESRestTestCase#createAdditionalFeatureSpecifications
if sufficient.
2024-04-11 18:22:38 +02:00
Daniel
412f2f5617
New Lucene spanish plural stemmer (#106952)
Add Lucene SpanishPluralStemFilter based on apache/lucene#11284
2024-04-02 15:53:19 -04:00
William Brafford
d07651f8b9
Checkstyle: require braces around do, for, and while clauses (#103217)
* Checkstyle requires braces after for, do, while
2024-01-09 16:03:45 -05:00
Armin Braun
e20821f13e
Remove some more ActionType subclasses (#103055)
Cleaned up a few more of these.
2023-12-07 22:05:45 +01:00
Armin Braun
cdc83ad29b
Add shorthand for prepareIndex to test infrastructure (#101187)
Same as #101175, shorten `client().prepareIndex(index)` and
`client().prepareIndex().setIndex(index)` via a test utility.
Saves lots of code now and sets up some follow-up simplifcations.
2023-11-23 15:47:36 +01:00
Armin Braun
a9c286b25c
Collapse verbose .execute().actionGet() calls in tests (#102502)
Cleaning this up a little even though it's still quite horrible.
`.get()` in this API actually means `actionGet()` so to speak.
I think a good first step to cleaning this up is to at least reduce
the duplication though and save 1k lines.
2023-11-23 10:10:10 +01:00
Veljko Potparic
5f30563d6c
Add support for Serbian Language Analyzer (#100921)
Starting with Lucene Version 8.6, an Analyzer for the Serbian language is available. 
This change adds support for this to the analysis-common module.
2023-11-15 23:46:55 +01:00
John Verwolf
5f089296aa
Update tests to decrement ref count (#102044)
Part of the broader work covered in
https://github.com/elastic/elasticsearch/issues/102030

Updates tests in: - HighlighterWithAnalyzersTests.java -
TokenCountFieldMapperIntegrationIT - GeoIpDownloaderIT.java -
DataStreamIT.java
2023-11-10 18:18:43 -05:00
David Turner
e8450706bd
Remove Releasable interface from clients (#101850)
No `Client` implementations hold any resources, so they don't need to be
`Releasable`. This commit removes the unnecessary interface. As well as
removing the dead code, this change means that IDEs no longer warn about
calling `ESIntegTestCase#client()` outside of a try-with-resources
block.
2023-11-07 07:34:51 -05:00
David Turner
4a37aef80b
Deprecate ExternalTestCluster (#101844)
`ExternalTestCluster` doesn't really make sense now that the transport
client is removed. We only use it in the ML integ test suite and it'd be
good to avoid expanding its usage further, so this commit deprecates it
and removes the functionality in `ESIntegTestCase` that might quietly
switch to using it in a new test suite if running with certain system
properties.

Relates #49582
2023-11-06 14:30:07 -05:00
Brian Seeders
eb39d6f276
Update analysis-common module to use new rest test framework (#100719) 2023-10-30 13:42:25 -04:00
Simon Cooper
22381fd6a7
Refactor overrides of old Plugin.createComponents method to new services method (#101381) 2023-10-26 16:58:14 +01:00
Simon Cooper
3e2f17fe84
Refactor uses of old Plugin.createComponents method to new services method (#101376) 2023-10-26 15:34:11 +01:00
David Turner
9794c6e205
Use ESIntegTestCase#prepareSearch more (#101179)
The refactoring in #101175 only covered all the one-arg call sites. This
PR does the rest.
2023-10-20 18:33:00 +01:00
David Turner
1eda6ac74b
Extract ESIntegTestCase#prepareSearch (#101175)
Relates #101172
2023-10-20 06:18:58 -04:00
Ryan Ernst
8a1db8c6c3
Move index version constants to IndexVersions (#101094)
Similar to the TransportVersions holder class, IndexVersions is the new
place to contain all constants for IndexVersion. This commit moves all
existing constants to the new class. It is purely mechanical.
2023-10-19 20:44:51 -04:00