Commit graph

18036 commits

Author SHA1 Message Date
Mridula
095eac1790 Merge branch 'main' into pinned-retriever 2025-04-17 12:58:04 +01:00
Nick Tindall
270ca0a80a
Add thread pool utilisation metric (#120363)
There are existing metrics for the active number of threads, but it seems tricky to go from those to a "utilisation" number because all the pools have different sizes.

This commit adds `es.thread_pool.{name}.threads.utilization.current` which will be published by all  `TaskExecutionTimeTrackingEsThreadPoolExecutor` thread pools (where `EsExecutors.TaskTrackingConfig#trackExecutionTime` is true).

The metric is a double gauge indicating what fraction (in [0.0, 1.0]) of the maximum possible execution time was utilised over the polling interval.

It's calculated as actualTaskExecutionTime / maximumTaskExecutionTime, so effectively a "mean" value. The metric interval is 60s so brief spikes won't be apparent in the measure, but the initial goal is to use it to detect hot-spotting so the 60s average will probably suffice.

Relates ES-10530
2025-04-17 11:49:30 +10:00
Tim Vernum
e53d3ff64b
Update docs to reflect removal of TLSv1.1 (#126892)
In ES9 and later, we do not enable TLSv1.1 by default,
even if the JDK supports it.

This updates the docs accordingly.

Relates: #121731
2025-04-17 10:15:29 +10:00
Mridula
dada60fe69 Merge branch 'main' into pinned-retriever 2025-04-16 22:56:46 +01:00
Benjamin Trent
b1f766258b
Temporarily bypass competitive iteration for filters aggregation (#126956) 2025-04-16 23:08:17 +02:00
Samiul Monir
2e1101cf5e
Updating text_similarity_reranker documentation (#126175)
* Updating text_similarity_reranker documentation

* Updating docs to include urls

* remove extra THE from the text

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-04-16 17:05:30 -04:00
Ryan Ernst
a813949c34
Fix uniquify to handle multiple successive duplicates (#126889)
CollectionUtils.uniquify is based on C++ std::unique. However, C++
iterators are not quite the same as Java iterators. In particular,
advancing them only allows grabbing the value once. This commit reworks
uniquify to be based on list indices instead of iterators.

closes #126883
2025-04-16 21:00:27 +02:00
Jonathan Buttner
7a0f63c1a0
[ML] Refactor inference request executor to leverage scheduled execution (#126858)
* Using threadpool schedule and fixing tests

* Update docs/changelog/126858.yaml

* Clean up

* change log
2025-04-16 14:14:02 -04:00
Jonathan Buttner
e42c118ec6
[ML] Adding missing onFailure call for Inference API start model request (#126930)
* Adding missing onFailure call

* Update docs/changelog/126930.yaml
2025-04-16 14:07:13 -04:00
Nik Everett
128144dd6d
ESQL: Add documents_found and values_loaded (#125631)
This adds `documents_found` and `values_loaded` to the to the ESQL response:
```json
{
  "took" : 194,
  "is_partial" : false,
  "documents_found" : 100000,
  "values_loaded" : 200000,
  "columns" : [
    { "name" : "a", "type" : "long" },
    { "name" : "b", "type" : "long" }
  ],
  "values" : [[10, 1]]
}
```

These are cheap enough to collect that we can do it for every query and
return it with every response. It's small, but it still gives you a
reasonable sense of how much work Elasticsearch had to go through to
perform the query.

I've also added these two fields to the driver profile and task status:
```json
    "drivers" : [
      {
        "description" : "data",
        "cluster_name" : "runTask",
        "node_name" : "runTask-0",
        "start_millis" : 1742923173077,
        "stop_millis" : 1742923173087,
        "took_nanos" : 9557014,
        "cpu_nanos" : 9091340,
        "documents_found" : 5,   <---- THESE
        "values_loaded" : 15,    <---- THESE
        "iterations" : 6,
...
```

These are at a high level and should be easy to reason about. We'd like to
extract this into a "show me how difficult this running query is" API one
day. But today, just plumbing it into the debugging output is good.

Any `Operator` can claim to "find documents" or "load values" by overriding
a method on its `Operator.Status` implementation:
```java
/**
 * The number of documents found by this operator. Most operators
 * don't find documents and will return {@code 0} here.
 */
default long documentsFound() {
    return 0;
}

/**
 * The number of values loaded by this operator. Most operators
 * don't load values and will return {@code 0} here.
 */
default long valuesLoaded() {
    return 0;
}
```

In this PR all of the `LuceneOperator`s declare that each `position` they
emit is a "document found" and the `ValuesSourceValuesSourceReaderOperator`
says each value it makes is a "value loaded". That's pretty pretty much
true. The `LuceneCountOperator` and `LuceneMinMaxOperator` sort of pretend
that the count/min/max that they emit is a "document" - but that's good
enough to give you a sense of what's going on. It's *like* document.
2025-04-16 17:15:25 +02:00
Lorenzo Dematté
115062c643
Fix vec_caps to test for OS support too (on x64) (#126911)
On x64, we are testing if we support vector capabilities (1 = "basic" = AVX2, 2 = "advanced" = AVX-512) in order to enable and choose a native implementation for some vector functions, using CPUID.

However, under some circumstances, this is not sufficient: the OS on which we are running also needs to support AVX/AVX2 etc; basically, it needs to acknowledge it knows about the additional register and that it is able to handle them e.g. in context switches. To do that we need to a) test if the CPU has xsave feature and b) use the xgetbv to test if the OS set it (declaring it supports AVX/AVX2/etc).

In most cases this is not needed, as all modern OSes do that, but for some virtualized situations (hypervisors, emulators, etc.) all the component along the chain must support it, and in some cases this is not a given.

This PR introduces a change to the x64 version of vec_caps to check for OS support too, and a warning on the Java side in case the CPU supports vector capabilities but those are not enabled at OS level.

Tested by passing noxsave to my linux box kernel boot options, and ensuring that the avx flags "disappear" from /proc/cpuinfo, and we fall back to the "no native vector" case.

Fixes #126809
2025-04-16 16:06:46 +02:00
Luca Cavanna
df83e881f9
Cancel expired async search task when a remote returns its results (#126583)
A while ago we enabled using ccs_minimize_roundtrips in async search.
This makes it possible for users of async search to send a single search
request per remote cluster, and minimize the impact of network latency.

With non minimized roundtrips, we have pretty recurring cancellation checks:
as part of the execution, we detect that a task expired whenever each shard comes
back with its results.

In a scenario where the coord node does not hold data, or only remote data is
targeted by an async search, we have much less chance of detecting cancellation
if roundtrips are minimized. The local coordinator would do nothing other than
waiting for the minimized results from each remote cluster.
One scenario where we can check for cancellation is when each cluster comes
back with its full set of results. This commit adds such check, plus some testing
for async search cancellation with minimized roundtrips.
2025-04-16 14:21:59 +02:00
Niels Bauman
5383f0fcdf
Fix PolicyStepsRegistry cache concurrency issue (#126840)
The following order of events was possible:
- An ILM policy update cleared `cachedSteps`
- ILM retrieves the step definition for an index, this populates `cachedSteps` with the outdated policy
- The updated policy is put in `lifecyclePolicyMap`

Any subsequent cache retrievals will see the old step definition.

By clearing `cachedSteps` _after_ we update `lifecyclePolicyMap`, we
ensure eventual consistency between the policy and the cache.

Fixes #118406
2025-04-16 13:58:12 +02:00
Liam Thompson
92148cfde3
[DOCS] Update esql-lookup-join.md to mention index mode requirement (#126901)
*  Update esql-lookup-join.md to mention index mode requirement

* fix 8.x page mapping metadata
2025-04-16 12:15:45 +02:00
Carson Ip
5860ccb113
[otel-data] Bump plugin version to release _metric_names_hash changes (#126850)
Bump otel-data plugin version as #120952 missed the bump.
2025-04-16 10:27:19 +01:00
Paul Tavares
ad0c215369
[Security Solution] Add read index privileges to kibana_system role for Microsoft Defender integration indexes (#126803)
adds read privilege to the kibana_system role for indexes associated with the Microsoft Defender Integrations.
Changes are necessary in order to support Security Solution bi-directional response actions
2025-04-15 15:42:16 -04:00
Ryan Ernst
6174acdc39
Workaround max name limit imposed by Jackson 2.17 (#126806)
In Jackson 2.15 a maximum string length of 50k characters was
introduced. We worked around that by override the length to max int on
all parsers created by xcontent. Jackson 2.17 introduced a similar limit
on field names. This commit mimics the workaround for string length by
overriding the max name length to be unlimited.

relates #58952
2025-04-15 11:40:27 -07:00
Liam Thompson
9ca38f93e8
Re-fix elasticsearch highlights for 9.0 (#126859) 2025-04-15 18:38:05 +02:00
Luigi Dell'Aquila
de42ba37e0
ES|QL: fix join masking eval (#126614) 2025-04-15 18:07:05 +02:00
elasticsearchmachine
e030e44881 Prune changelogs after 8.17.5 release 2025-04-15 14:49:20 +00:00
Svilen Mihaylov
02f9af732e
Add multi_match function #121525 (#125062)
Implement multi_match function for ESQL. Its currently available on snapshot builds pending refinement of the syntax.
2025-04-15 09:38:08 -04:00
Francisco Fernández Castaño
39670d9477
Add IndexingPressureMonitor to monitor large indexing operations (#126372)
Relates ES-11063
2025-04-15 13:23:18 +02:00
Richard Dennehy
9e3476ef99
permit at+jwt typ header value in jwt access tokens (#126687)
* permit at+jwt typ header value in jwt access tokens

* Update docs/changelog/126687.yaml

* address review comments

* [CI] Auto commit changes from spotless

* update Type Validator tests for parser ignoring case

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-04-15 11:08:30 +01:00
Liam Thompson
7de46e9897
[DOCS] Update es-connectors-salesforce.md (#126828)
* [DOCS] Update es-connectors-salesforce.md

9.x equivalent of https://github.com/elastic/elasticsearch/pull/126791

* Reformat known issues section
2025-04-15 11:47:36 +02:00
Liam Thompson
b326ebb1dd
Fix 8.x page mapping for ES release notes (#126820) 2025-04-15 10:26:29 +02:00
Ignacio Vera
bcee0af23c
Return float[] instead of List<Double> in valueFetcher (#126702)
We are currently having to hold in heap big list of Double objects which can take big amounts of heap. With this change 
we can reduce the heap usage by 7x.
2025-04-15 07:03:55 +02:00
Nick Tindall
dfaf3de96e
Allow float settings to be configured with other settings as default (#126751)
Relates ES-11367
2025-04-15 13:41:01 +10:00
Dan Rubinstein
b917d9a1e0
Revert endpoint creation validation for ELSER and E5 (#126792)
* Revert endpoint creation validation for ELSER and E5

* Update docs/changelog/126792.yaml

* Revert start model deployment being in TransportPutInferenceModelAction

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-04-14 17:00:33 -04:00
Ryan Ernst
b47bd3adc7
Use terminal reader in keystore add command (#126729)
When reading a string value from stdin the keystore add command
currently looks directly at stdin. However, stdin may also be consumed
while reading the keystore password. This commit changes the add command
to use the reader from the termainl instead of looking at stdin
directly.

closes #98115
2025-04-14 12:55:56 -07:00
Mike Pellegrini
85713f78e0
Semantic Text Chunking Indexing Pressure (#125517)
We have observed many OOMs due to the memory required to inject chunked inference results for semantic_text fields. This PR uses coordinating indexing pressure to account for this memory usage. When indexing pressure memory usage exceeds the threshold set by indexing_pressure.memory.limit, chunked inference result injection will be suspended to prevent OOMs.
2025-04-14 15:55:37 -04:00
Mridula
aefc0c6bc9 Merge branch 'main' into pinned-retriever 2025-04-14 19:58:15 +01:00
Brian Seeders
01a8a9b63b
[docs] Fix 9.0.0 release notes issues 2025-04-14 14:34:31 -04:00
Benjamin Trent
d7a547597e
Fix bbq quantization algorithm but for differently distributed components (#126778)
We had a silly bug in quantizing vectors in bbq where we were scaling
the initial quantile optimization parameters incorrectly given the
vector component distribution. 

In distributions where this has a major impact, the recall results were
abysmal and rendered the quantization technique useless. 

In modern, well distributed components, this change is almost a no-op.
2025-04-15 04:21:51 +10:00
Charlotte Hoblik
8cb449386b
remove redirects.yml (#126774) 2025-04-14 14:10:49 +02: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
Kofi B
08beb534ef
[DOCS] Added sort order explanation (#125182)
* Added explanation of sort order and default behavior

* Update docs/reference/elasticsearch/rest-apis/sort-search-results.md

Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>

---------

Co-authored-by: George Wallace <georgewallace@users.noreply.github.com>
Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
2025-04-14 10:28:03 +02:00
Craig Taverner
ec495e9f0b
Make LOOKUP JOIN docs examples fully tested (#126622)
The current LOOKUP JOIN docs include examples that are not tested by the ES|QL tests, unlike most other examples in the documentation. This PR fixes that, changing two examples to use existing tests, and adding a new csv-spec file for the remaining four examples. These four are not required to show results, so the tests have empty data and do not require any results. This means we are testing only the syntax (parsing and semantic analysis), which is sufficient for the docs.
2025-04-14 09:57:58 +02:00
Jan Kuipers
3f2f5ee158
ES|QL change_point docs and tech preview (#126407)
* ES|QL change point docs

* Move ES|QL change_point to tech preview

* Update docs/reference/query-languages/esql/esql-commands.md

Co-authored-by: Craig Taverner <craig@amanzi.com>

* different example + add it the csv tests

* Restructure change_point docs to new structure

* Added generated test examples to change_point docs

* Fixed a few README.md text mistakes and added more details

* fix grammar

* License check

* regen parser

* Update docs/reference/query-languages/esql/_snippets/commands/layout/change_point.md

Co-authored-by: Craig Taverner <craig@amanzi.com>

---------

Co-authored-by: Craig Taverner <craig@amanzi.com>
2025-04-14 09:56:03 +02:00
Lisa Cawley
ae33eaabdb
[DOCS] Fix broken images (#126648) 2025-04-11 19:04:08 -07:00
Mikhail Berezovskiy
c8805b85d2
Add flow-control and remove auto-read in netty4 HTTP pipeline (#126441) 2025-04-11 14:54:22 -07:00
Jack Conradson
c1ecafad6a
Fix painless return type cast for list shortcut (#126724)
This fixes an issue where if a Painless getter method return type
 didn't match a Java getter method return type we add a cast. 
Currentlythis is adding an extraneous cast.

Closes: #70682
2025-04-11 13:50:19 -07:00
Oleksandr Kolomiiets
9d18d5280a
Add block loader from stored field and source for ip field (#126644) 2025-04-11 13:37:15 -07:00
Nik Everett
55a6624746
ESQL: TO_IP can handle leading zeros (#126532)
Modifies TO_IP so it can handle leading `0`s in ipv4s. Here's how it
works now:
```
ROW ip = TO_IP("192.168.0.1") // OK!
ROW ip = TO_IP("192.168.010.1") // Fails
```

This adds
```
ROW ip = TO_IP("192.168.010.1", {"leading_zeros": "octal"})
ROW ip = TO_IP("192.168.010.1", {"leading_zeros": "decimal"})
```

We do this because there isn't a consensus on how to parse leading zeros
in ipv4s. The standard unix tools like `ping` and `ftp` interpret
leading zeros as octal. Java's built in ip parsing interprets them as
decimal. Because folks are using this for security rules we need to
support all the choices.

Closes #125460
2025-04-11 19:45:14 +02:00
Jack Conradson
856323594d
Add a custom toString to DynamicMap (#126562)
This change prevents a delegate map from giving an inconsistent 
toString or an empty toString.

Closes #70262
2025-04-11 08:34:48 -07:00
David Turner
1461820dac
Fix race condition in RestCancellableNodeClient (#126686)
Today we rely on registering the channel after registering the task to
be cancelled to ensure that the task is cancelled even if the channel is
closed concurrently. However the client may already have processed a
cancellable request on the channel and therefore this mechanism doesn't
work. With this change we make sure not to register another task after
draining the registrations in order to cancel them.

Closes #88201
2025-04-12 00:59:46 +10:00
Bogdan Pintea
9784e0ec5f
ESQL: Split grouping functions based on their EVAL-ability (#126597)
This splits the grouping functions in two: those that can be evaluated independently through the EVAL operator (`BUCKET`) and those that don't (like those that that are evaluated through an agg operator, `CATEGORIZE`).

Closes #124608
2025-04-11 16:19:54 +02:00
Nik Everett
5689dfa9bb
ESQL: Heuristics to pick efficient partitioning (#125739)
Adds heuristics to pick an efficient partitioning strategy based on the
index and rewritten query. This speeds up some queries by throwing more
cores at the problem:
```
FROM test | STATS SUM(b)

Before: took: 31 CPU: 222.3%
 After: took: 15 CPU: 806.9%
```

It also lowers the overhead of simpler queries by throwing less cores at
the problem when it won't really speed anything up:
```
FROM test

Before: took: 1 CPU: 48.5%
 After: took: 1 CPU: 70.4%
```

We have had a `pragma` to control our data partitioning for a long time,
this just looks at the query to pick a partitioning scheme. The
partitioning options:
* `shard`: use one core per shard
* `segment`: use one core per large segment
* `doc`: break each shard into as many segments as there are cores

`doc` is the fastest, but has a lot of overhead, especially for complex
Lucene queries. `segment` is fast, but doesn't make the most out of CPUs
when there are few segments. `shard` has the lowest overhead.

Previously we always used `segment` partitioning because it doesn't have
the terrible overhead but is fast. With this change we use `doc` when
the top level query matches all documents - those have very very low
overhead even in the `doc` partitioning. That's the twice as fast
example above.

This also uses the `shard` partitioning for queries that don't have to
do much work like `FROM foo` or `FROM foo | LIMIT 1` or
`FROM foo | SORT a`. That's the lower CPU example above.

This forking choice is taken very late on the data node. So queries like
this:
```
FROM test | WHERE @timestamp > "2025-01-01T00:00:00Z" | STATS SUM(b)
```
can also use the `doc` partitioning when all documents are after the
timestamp and all documents have `b`.
2025-04-11 09:58:35 -04:00
Colleen McGinnis
24dfda583f
update mapped_pages (#126647) 2025-04-11 08:48:29 -05:00
Fang Xing
e8ffb38d5d
[ES|QL] Retrieve token text only when necessary (#126578)
* retrieve token text only when necessary
2025-04-11 09:40:20 -04:00
kanoshiou
4cc21b6f35
ESQL: Fix NULL handling in IN clause (#125832)
This PR fixes #119950 where an `IN` query includes `NULL` values with non-NULL `DataType` appearing within the query range. An expression is considered `NULL` when its `DataType` is `NULL` or it is a `Literal` with a value of `null`.
2025-04-11 14:58:28 +02:00