Commit graph

136 commits

Author SHA1 Message Date
Oleksandr Kolomiiets
26e2261132
Remove legacy block loader test infrastructure (#127273) 2025-04-25 10:26:27 -07:00
Armin Braun
50437e79d3
Cleanup missing use of StandardCharsets (#125424)
Random annoyance that I figured, I'd just fix globally:
We can do a bit of a cleaner job when doing byte <-> string conversion here and there.
2025-03-21 20:10:15 +01:00
Kostas Krikellas
8de9539e29
Lazy initialization for SyntheticSourceSupport.loader() (#120896)
* Lazy initialization for `SyntheticSourceSupport.loader()`

* [CI] Auto commit changes from spotless

* add missing

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-01-27 17:12:42 +02:00
Simon Cooper
a2d84b1b90
Remove assumed features in server for 9.0 (#119946)
All features added before 8.18 can now be assumed and removed in 9.0
2025-01-15 08:37:04 +00:00
Simon Cooper
75d1050781
Mark all features added before 8.18 as assumed (#119055)
Features added before 8.18 can be removed, starting with 9.0. But first they need to be marked as assumed, so existing code knows they could be removed in later builds.
2025-01-09 16:59:25 +00:00
Svilen Mihaylov
93c349cc76
Add ability to set "max_analyzed_offset" implicitly to "index.highlight (#118895)
Add ability to set "max_analyzed_offet" implicitly to "index.highlight
.max_analyzed_offset", by setting it excplicitly to "-1".

Closes #112822
2025-01-07 11:19:07 -05: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
Oleksandr Kolomiiets
2b8e4e727c
Migrate mapper-related modules to internal-*-rest-test (#117298) 2024-11-23 00:35:24 +00:00
Rene Groeschke
f6ac6e1c3b
[Build] Remove deprecated BuildParams (#116984) 2024-11-22 16:30:57 +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
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
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
Oleksandr Kolomiiets
16bde51891
Remove IndexMode#isSyntheticSourceEnabled (#114963) 2024-10-18 13:48:12 -07:00
Mark Vieira
a59c182f9f
Add AGPLv3 as a supported license 2024-09-13 15:29:46 -07:00
Kostas Krikellas
86a88d735f
Fix synthetic source field names for multi-fields (#112850)
* Fix synthetic source field names for multi-fields

* enable logsdb in randomized tests

* Revert "enable logsdb in randomized tests"

This reverts commit 2e2c22e2bb.

* Update docs/changelog/112850.yaml

* fix
2024-09-13 15:00:55 +03:00
Oleksandr Kolomiiets
082e7211b3
Use fallback synthetic source for copy_to and doc_values: false cases (#112294) 2024-09-10 12:12:51 -07:00
Kostas Krikellas
f3bc281978
Refactor build params for FieldMapper, adding SourceKeepMode (#112455)
* Refactor build params for FieldMapper

* more mappers and tests

* more mappers

* more mappers

* spotless

* spotless

* stored by default

* Revert "stored by default"

This reverts commit bbd247d64b.

* restore storeIgnored

* sync

* list valid values for SourceKeepMode

* small refactoring

* spotless
2024-09-06 14:16:17 +03:00
Oleksandr Kolomiiets
38adbb0724
Prevent synthetic field loaders accessing stored fields from using stale data (#112173) 2024-08-27 14:55:00 -07:00
Oleksandr Kolomiiets
349dac284a
Stop iterating over all fields to extract @timestamp value (#110603) 2024-07-11 09:24:53 -07:00
Luca Cavanna
915e4a50c5
Rename Mapper#name to Mapper#fullPath (#110040)
This addresses a long standing TODO that caused quite a few bugs over time, in that the mapper name does not include its full path, while the MappedFieldType name does.

We have renamed Mapper.Builder#name to leafName (#109971) and Mapper#simpleName to leafName (#110030). This commit renames Mapper#name to fullPath for clarity
This required some adjustments in FieldAliasMapper to avoid confusion between the existing path method and fullPath. I renamed path to targetPath for clarity.
ObjectMapper already had a fullPath method that returned name, and was effectively a copy of name, so it could be removed.
2024-06-21 22:47:27 +02:00
Luca Cavanna
54e7b4d93b
Rename Mapper#simpleName to Mapper#leafName (#110030)
This addresses a long standing TODO that caused quite a few bugs over time, in that the mapper name does not include its full path, while
the MappedFieldType name does. We have method called simpleName to signal that, but leafName signals that more clearly and aligns with
the name we have recently introduced in Mapper.Builder (renamed from name to leafName).

Relates to #109971
2024-06-21 14:28:36 +02:00
Luca Cavanna
15c7abe111
Rename Mapper#name to Mapper#leafName (#109971)
This addresses a long standing TODO that caused quite a few bugs over time, in that the mapper name does not include its full path, while
the MappedFieldType name does.
2024-06-21 11:48:17 +02:00
Oleksandr Kolomiiets
91d502cec6
Add generic fallback implementation for synthetic source (#108222)
This PR uses infrastructure from #107567 to implement a fallback implementation of synthetic source for field mappers that don't support it natively. In that case we will store source of such field as is in a separate stored field.
2024-05-21 11:30:30 -07:00
Oleksandr Kolomiiets
ca513b1752
Annotated text fields are stored by default with synthetic source (#107922)
This change follows existing implementation for text field.

Closes #107734.
2024-04-26 10:12:17 -07:00
Oleksandr Kolomiiets
e1d902d33b
Implement synthetic source support for annotated text field (#107735)
This PR adds synthetic source support for annotated_text fields. Existing implementation for text is reused including test infrastructure so the majority of the change is moving and making things accessible.

Contributes to #106460, #78744.
2024-04-25 10:31:27 -07: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
Felix Barnsteiner
5920c917aa
Encapsulate Mapper.Builder#name and make it private (#105648)
This is in preparation to make the field mutable,
which is needed in the context of https://github.com/elastic/elasticsearch/pull/103542
2024-02-20 15:53:14 +01:00
Armin Braun
433517ad01
Misc cleanup in o.e.search.fetch (#101939)
Just some random findings from researching other things.
Removing all kinds of dead code and fixing obvious duplication in 2 spots.
2023-11-09 13:46:00 +01:00
Armin Braun
6fc05a6bb1
Remove redundant fields on TextFieldMapper and KeywordFieldMapper (#99666)
These fields were also on the mapped field types, no need to waste bytes
on them.
2023-09-19 10:43:42 -04:00
Alan Woodward
4e1fb3fca5
Automatically disable ignore_malformed on datastream @timestamp fields (#99346)
Data-stream mappings require a @timestamp field to be present and configured
as a date with a specific set of parameters. The index-wide setting of
ignore_malformed can cause problems here if it is set to true, because it needs
to be false for the @timestamp field.

This commit detects if a set of mappings is configured for a datastream by checking
for the presence of a DataStreamTimestampFieldMapper metadata field, and passes
that information on during Mapper construction as part of the MapperBuilderContext.
DateFieldMapper.Builder now checks to see if it is specifically for a data stream timestamp
field, and if it is, sets ignore_malformed to false.

Relates to #96051
2023-09-13 15:02:22 +01:00
Armin Braun
574fb05946
Deduplicate org.apache.lucene.document.FieldType instances across mappers (#99361)
We mostly have a handful of `FieldType` values here across all mappers and none of them contain
attributes. There's only so many combinations here, lets deduplicate these to save some heap and set up
subsequent mapper heap savings.
2023-09-08 22:18:35 +02:00
Armin Braun
f1a376c317
Remove CopyTo.Builder (#99368)
The copyTo builder is really hard to reason about when it comes to
mapper merging, because the `reset` method would actually mutate an
existing mapper. That seems dangerous and the whole thing is quite
inefficient as well. -> this PR just removes it and uses a copy
constructor for copy on write, avoiding instance creation on mapper
merges here and there and leaving no doubt about these things being
immutable.
2023-09-08 13:24:31 -04:00
Jim Ferenczi
28a504d7a1
Use the Weight#matches mode for highlighting by default (#96068)
This PR adapts the unified highlighter to use the Weight#matches mode by default when possible.
This is the default mode in Lucene for some time now. For cases where the matches mode won't work (nested and parent-child queries),
 the matches mode is disabled automatically.
I didn't expose an  option to explicitly disable this mode because that should be seen as an internal implementation detail.
With this change, matches that span multiple terms are highlighted together (something that users asked for years) and the clauses that don't match the document are ignored.
2023-08-09 10:44:38 +09:00
Simon Cooper
a873e26cf7
Convert IndexVersion.CURRENT to a method with a pluggable interface (#97132) 2023-06-27 14:47:32 +01:00
Simon Cooper
71c12262fb
Migrate index created version to IndexVersion (#96066) 2023-06-14 09:43:31 +01:00
Alan Woodward
093e36c875
Introduce DocumentParsingException (#92646)
Document parsing methods currently throw MapperParsingException. This
isn't very helpful, as it doesn't contain any information about where the parse
error happened - it is designed for parsing mappings, which are realised into
java maps before being examined. This commit introduces a new exception
specifically for document parsing that extends XContentException, so that
it reports the current position of the parser as part of its error message.

Fixes #85083
2023-03-31 12:14:19 +01:00
Simon Cooper
56d53da381
Migrate LuceneDocument.getFields(String) to a List (#94830) 2023-03-29 11:08:36 +01:00
Alan Woodward
35da97214c
Make IndexAnalyzers an interface (#94819)
IndexAnalyzers is currently always a concrete class wrapping several
Maps of NamedAnalyzers. This means that whenever it is used it needs
to instantiate all of its component analyzers, making testing much heavier
than it needs to be. It also means that things like overriding analysis for
legacy indexes is pushed into mapper parameters, rather than being
handled in a single place.

This commit makes IndexAnalyzers into an interface, with an anonymous
concrete implementation that handles reloading and closing for index
shards.
2023-03-28 16:07:08 +01:00
Alan Woodward
639eab0549
Remove force_source option for highlighting (#93193)
This was only needed because the percolator uses a MemoryIndex which did
not support stored fields, and so when it ran a highlighting phase it needed to
force it to read from source. MemoryIndex added stored fields support in
lucene 9.5, so we can remove this internal parameter.

The parameter remains available, but deprecated, via the rest layer, and no
longer has any effect.
2023-02-21 09:51:28 +00:00
Denilson das Mercês Amorim
09ccaa02b8
Annotated highlight does not include annotation when search contains both annotation and annotated term (#92920)
The annotation highlighter can miss annotations if they overlap with another search
term.  This commit re-sorts incoming passages to ensure that all terms are seen
by the highlighter.

Fixes #91944
2023-01-23 13:15:46 +00:00
Mark Vieira
c2eda511de
Add JUnit rule based integration test cluster orchestration framework (#92379)
This commit adds a new test framework for configuring and orchestrating
test clusters for both Java and YAML REST testing. This will eventually
replace the existing "test-clusters" Gradle plugin and the build-time
cluster orchestration.
2022-12-21 15:33:46 -08:00
Nik Everett
c71aa06463
Support fields in synthetic source in last cases (#91595)
This adds support for the `fields` API from painless in to synthetic
_source for `text` fields that have a keyword sub field. This is kind of
esoteric sounding, but it's the default mapping for strings you send in
json so synthetic `_source` supports it. So the `fields` API should too.
2022-11-16 13:47:48 -05:00
Nik Everett
74d0d19c0f
Synthetic _source: support field in many cases (#89950)
This adds support for the `field` scripting API in many but not all
cases. Before this change numbers, dates, and IPs supported the `field`
API when running with _source in synthetic mode because they always have
doc values. This change adds support for `match_only_text`, `store`d
`keyword` fields, and `store`d `text` fields. Two remaining field
configurations work with synthetic _source and do not work with `field`:
* A `text` field with a sub-`keyword` field that has `doc_values` * A
`text` field with a sub-`keyword` field that is `store`d

![image](https://user-images.githubusercontent.com/215970/189217841-4378ed42-e454-42c1-aaf0-6c2c041b29be.png)
2022-11-10 10:44:06 -05:00
Alan Woodward
41ab45a5d9
Report synthetic source status in MapperBuilderContext (#91400)
We currently work out whether or not a mapper should be storing additional
values for synthetic source by looking at the DocumentParserContext. However,
this value does not change for the lifetime of the mapper - it is defined by
metadata on the root mapper and is immutable - and DocumentParserContext
feels like the wrong place for this information as it holds context specific
to the document being parsed.

This commit moves synthetic source status information from DocumentParserContext
to MapperBuilderContext instead. Mappers which need this information retrieve
it at build time and hold it on final fields.
2022-11-08 14:55:16 +00:00
Nik Everett
bc49392bfb
Support malformed numbers in synthetic _source (#90428)
This adds support for `ignore_malformed` to numeric fields other than
`scaled_float` in synthetic `_source`. Their values are saved to a
stored field and loaded to render the `_source`.
2022-10-04 12:17:30 -04:00
Nik Everett
f4fad2548f
Always support ignore_malformed in the same way (#90565)
This makes sure that all field types that support `ignore_malfored` do
so in the same way.

Production changes:
* All mapper has an `ignoreMalformed` method that must return `true` if
  the field accepts the `ignore_malformed` mapping parameter was
  configured. It defaults to `false` because many fields either don't
  have a concept of "malformed" value or don't have the ability to
  ignore malformed values.
* Fix the `scaled_float` field to store it's field name in `_ignored` if
  it ignores any malfored values. This is how all other field mappers
  work.

Test changes:
* `MapperTestCase` forces subclasses to declare if their
  `supportIgnoreMalformed` or not.
* If `MapperTestCase` subclasses `supportIgnoreMalfored` they must
  define some `exampleMalformedValues`.
* `MapperTestCase` always grows three new tests:
  * One that creates a field without setting `ignore_malformed` and
    verifies that all `exampleMalformedValues` throw expected errors
  * On that explicitly configured `ignore_malformed` to false and, if
    `supportIgnoreMalformed` it verifies the errors again. If not
    `supportIgnoreMalformed` it verifies that the parameter is unknown.
  * On that explicitly configured `ignore_malformed` to true and, if
    `supportIgnoreMalformed` it verifies that parsing doesn't produce
    errors and correctly produces `_ignored`. If not
    `supportIgnoreMalformed` it verifies that the parameter is unknown.
* Moved some subclasesses of `MapperTestCase` from
  `internalClusterTests` to `tests`. This isn't strictly required but
  that's the right place for them.
2022-10-03 06:18:02 -04:00
Rene Groeschke
cdf5bd7ed0
Rework testing conventions gradle plugin (#87213)
This PR reworks the testing conventions precommit plugin. This plugin now:
- is compatible with yaml, java rest tests and internalClusterTest (aka different sourceSets per test type)
- enforces test base class and simple naming conventions (as it did before)
- adds one check task per test sourceSet
- uses the worker api to improve task execution parallelism and encapsulation
- is gradle configuration cache compatible  

This also ports the TestingConventions integration testing to Spock and removes the build-tools-internal/test kit folder that is not required anymore. We also add some common logic for testing java related gradle plugins. 
We will apply further cleanup on other tests within our test suite in a dedicated follow up cleanup
2022-06-20 16:26:38 +02:00