Skip to content

Commit

Permalink
Merge branch 'main' into transform_node_info_api
Browse files Browse the repository at this point in the history
  • Loading branch information
przemekwitek committed May 14, 2024
2 parents ca35e8c + 77ce605 commit 78f894d
Show file tree
Hide file tree
Showing 319 changed files with 2,231 additions and 1,846 deletions.
2 changes: 2 additions & 0 deletions .buildkite/pipelines/periodic.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ steps:
- openjdk17
- openjdk21
- openjdk22
- openjdk23
GRADLE_TASK:
- checkPart1
- checkPart2
Expand All @@ -113,6 +114,7 @@ steps:
- openjdk17
- openjdk21
- openjdk22
- openjdk23
BWC_VERSION: $BWC_LIST
agents:
provider: gcp
Expand Down
2 changes: 2 additions & 0 deletions .buildkite/pipelines/periodic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ steps:
- openjdk17
- openjdk21
- openjdk22
- openjdk23
GRADLE_TASK:
- checkPart1
- checkPart2
Expand All @@ -760,6 +761,7 @@ steps:
- openjdk17
- openjdk21
- openjdk22
- openjdk23
BWC_VERSION: ["7.17.22", "8.13.5", "8.14.0", "8.15.0"]
agents:
provider: gcp
Expand Down
4 changes: 4 additions & 0 deletions distribution/packages/src/deb/lintian/elasticsearch
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,7 @@ unknown-field License
# don't build them ourselves and the license precludes us modifying them
# to fix this.
library-not-linked-against-libc usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/lib/libmkl_*.so

# shared-lib-without-dependency-information (now shared-library-lacks-prerequisites) is falsely reported for libvec.so
# which has no dependencies (not even libc) besides the symbols in the base executable.
shared-lib-without-dependency-information usr/share/elasticsearch/lib/platform/linux-x64/libvec.so
1 change: 1 addition & 0 deletions docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,7 @@ setups['setup-snapshots'] = setups['setup-repository'] + '''
name: "my_admin_role"
body: >
{
"description": "Grants full access to all management features within the cluster.",
"cluster": ["all"],
"indices": [
{"names": ["index1", "index2" ], "privileges": ["all"], "field_security" : {"grant" : [ "title", "body" ]}}
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog/107886.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 107886
summary: Cluster state role mapper file settings service
area: Authorization
type: enhancement
issues: []
6 changes: 6 additions & 0 deletions docs/changelog/108517.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 108517
summary: Forward `indexServiceSafe` exception to listener
area: Transform
type: bug
issues:
- 108418
5 changes: 5 additions & 0 deletions docs/changelog/108518.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 108518
summary: Remove leading is_ prefix from Enterprise geoip docs
area: Ingest Node
type: bug
issues: []
6 changes: 6 additions & 0 deletions docs/changelog/108521.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 108521
summary: Adding override for lintian false positive on `libvec.so`
area: "Packaging"
type: bug
issues:
- 108514
5 changes: 5 additions & 0 deletions docs/changelog/108522.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 108522
summary: Ensure we return non-negative scores when scoring scalar dot-products
area: Vector Search
type: bug
issues: []
6 changes: 6 additions & 0 deletions docs/changelog/108562.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 108562
summary: Add `internalClusterTest` for and fix leak in `ExpandSearchPhase`
area: Search
type: bug
issues:
- 108369
110 changes: 105 additions & 5 deletions docs/internal/DistributedArchitectureGuide.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Distributed Area Team Internals
# Distributed Area Internals

(Summary, brief discussion of our features)
The Distributed Area contains indexing and coordination systems.

The index path stretches from the user REST command through shard routing down to each individual shard's translog and storage
engine. Reindexing is effectively reading from a source index and writing to a destination index (perhaps on different nodes).
The coordination side includes cluster coordination, shard allocation, cluster autoscaling stats, task management, and cross
cluster replication. Less obvious coordination systems include networking, the discovery plugin system, the snapshot/restore
logic, and shard recovery.

A guide to the general Elasticsearch components can be found [here](https://github.com/elastic/elasticsearch/blob/main/docs/internal/GeneralArchitectureGuide.md).

# Networking

Expand Down Expand Up @@ -237,9 +245,101 @@ works in parallel with the storage engine.)

# Autoscaling

(Reactive and proactive autoscaling. Explain that we surface recommendations, how control plane uses it.)

(Sketch / list the different deciders that we have, and then also how we use information from each to make a recommendation.)
The Autoscaling API in ES (Elasticsearch) uses cluster and node level statistics to provide a recommendation
for a cluster size to support the current cluster data and active workloads. ES Autoscaling is paired
with an ES Cloud service that periodically polls the ES elected master node for suggested cluster
changes. The cloud service will add more resources to the cluster based on Elasticsearch's recommendation.
Elasticsearch by itself cannot automatically scale.

Autoscaling recommendations are tailored for the user [based on user defined policies][], composed of data
roles (hot, frozen, etc) and [deciders][]. There's a public [webinar on autoscaling][], as well as the
public [Autoscaling APIs] docs.

Autoscaling's current implementation is based primary on storage requirements, as well as memory capacity
for ML and frozen tier. It does not yet support scaling related to search load. Paired with ES Cloud,
autoscaling only scales upward, not downward, except for ML nodes that do get scaled up _and_ down.

[based on user defined policies]: https://www.elastic.co/guide/en/elasticsearch/reference/current/xpack-autoscaling.html
[deciders]: https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-deciders.html
[webinar on autoscaling]: https://www.elastic.co/webinars/autoscaling-from-zero-to-production-seamlessly
[Autoscaling APIs]: https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-apis.html

### Plugin REST and TransportAction entrypoints

Autoscaling is a [plugin][]. All the REST APIs can be found in [autoscaling/rest/][].
`GetAutoscalingCapacityAction` is the capacity calculation operation REST endpoint, as opposed to the
other rest commands that get/set/delete the policies guiding the capacity calculation. The Transport
Actions can be found in [autoscaling/action/], where [TransportGetAutoscalingCapacityAction][] is the
entrypoint on the master node for calculating the optimal cluster resources based on the autoscaling
policies.

[plugin]: https://github.com/elastic/elasticsearch/blob/v8.13.2/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/Autoscaling.java#L72
[autoscaling/rest/]: https://github.com/elastic/elasticsearch/tree/v8.13.2/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/rest
[autoscaling/action/]: https://github.com/elastic/elasticsearch/tree/v8.13.2/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/action
[TransportGetAutoscalingCapacityAction]: https://github.com/elastic/elasticsearch/blob/v8.13.2/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/action/TransportGetAutoscalingCapacityAction.java#L82-L98

### How cluster capacity is determined

[AutoscalingMetadata][] implements [Metadata.Custom][] in order to persist autoscaling policies. Each
Decider is an implementation of [AutoscalingDeciderService][]. The [AutoscalingCalculateCapacityService][]
is responsible for running the calculation.

[TransportGetAutoscalingCapacityAction.computeCapacity] is the entry point to [AutoscalingCalculateCapacityService.calculate],
which creates a [AutoscalingDeciderResults][] for [each autoscaling policy][]. [AutoscalingDeciderResults.toXContent][] then
determines the [maximum required capacity][] to return to the caller. [AutoscalingCapacity][] is the base unit of a cluster
resources recommendation.

The `TransportGetAutoscalingCapacityAction` response is cached to prevent concurrent callers
overloading the system: the operation is expensive. `TransportGetAutoscalingCapacityAction` contains
a [CapacityResponseCache][]. `TransportGetAutoscalingCapacityAction.masterOperation`
calls [through the CapacityResponseCache][], into the `AutoscalingCalculateCapacityService`, to handle
concurrent callers.

[AutoscalingMetadata]: https://github.com/elastic/elasticsearch/blob/v8.13.2/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/AutoscalingMetadata.java#L38
[Metadata.Custom]: https://github.com/elastic/elasticsearch/blob/v8.13.2/server/src/main/java/org/elasticsearch/cluster/metadata/Metadata.java#L141-L145
[AutoscalingDeciderService]: https://github.com/elastic/elasticsearch/blob/v8.13.2/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/capacity/AutoscalingDeciderService.java#L16-L19
[AutoscalingCalculateCapacityService]: https://github.com/elastic/elasticsearch/blob/v8.13.2/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/capacity/AutoscalingCalculateCapacityService.java#L43

[TransportGetAutoscalingCapacityAction.computeCapacity]: https://github.com/elastic/elasticsearch/blob/v8.13.2/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/action/TransportGetAutoscalingCapacityAction.java#L102-L108
[AutoscalingCalculateCapacityService.calculate]: https://github.com/elastic/elasticsearch/blob/v8.13.2/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/capacity/AutoscalingCalculateCapacityService.java#L108-L139
[AutoscalingDeciderResults]: https://github.com/elastic/elasticsearch/blob/v8.13.2/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/capacity/AutoscalingDeciderResults.java#L34-L38
[each autoscaling policy]: https://github.com/elastic/elasticsearch/blob/v8.13.2/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/capacity/AutoscalingCalculateCapacityService.java#L124-L131
[AutoscalingDeciderResults.toXContent]: https://github.com/elastic/elasticsearch/blob/v8.13.2/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/capacity/AutoscalingDeciderResults.java#L78
[maximum required capacity]: https://github.com/elastic/elasticsearch/blob/v8.13.2/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/capacity/AutoscalingDeciderResults.java#L105-L116
[AutoscalingCapacity]: https://github.com/elastic/elasticsearch/blob/v8.13.2/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/capacity/AutoscalingCapacity.java#L27-L35

[CapacityResponseCache]: https://github.com/elastic/elasticsearch/blob/v8.13.2/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/action/TransportGetAutoscalingCapacityAction.java#L44-L47
[through the CapacityResponseCache]: https://github.com/elastic/elasticsearch/blob/v8.13.2/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/action/TransportGetAutoscalingCapacityAction.java#L97

### Where the data comes from

The Deciders each pull data from different sources as needed to inform their decisions. The
[DiskThresholdMonitor][] is one such data source. The Monitor runs on the master node and maintains
lists of nodes that exceed various disk size thresholds. [DiskThresholdSettings][] contains the
threshold settings with which the `DiskThresholdMonitor` runs.

[DiskThresholdMonitor]: https://github.com/elastic/elasticsearch/blob/v8.13.2/server/src/main/java/org/elasticsearch/cluster/routing/allocation/DiskThresholdMonitor.java#L53-L58
[DiskThresholdSettings]: https://github.com/elastic/elasticsearch/blob/v8.13.2/server/src/main/java/org/elasticsearch/cluster/routing/allocation/DiskThresholdSettings.java#L24-L27

### Deciders

The `ReactiveStorageDeciderService` tracks information that demonstrates storage limitations are causing
problems in the cluster. It uses [an algorithm defined here][]. Some examples are
- information from the `DiskThresholdMonitor` to find out whether nodes are exceeding their storage capacity
- number of unassigned shards that failed allocation because of insufficient storage
- the max shard size and minimum node size, and whether these can be satisfied with the existing infrastructure

[an algorithm defined here]: https://github.com/elastic/elasticsearch/blob/v8.13.2/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/storage/ReactiveStorageDeciderService.java#L158-L176

The `ProactiveStorageDeciderService` maintains a forecast window that [defaults to 30 minutes][]. It only
runs on data streams (ILM, rollover, etc), not regular indexes. It looks at past [index changes][] that
took place within the forecast window to [predict][] resources that will be needed shortly.

[defaults to 30 minutes]: https://github.com/elastic/elasticsearch/blob/v8.13.2/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/storage/ProactiveStorageDeciderService.java#L32
[index changes]: https://github.com/elastic/elasticsearch/blob/v8.13.2/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/storage/ProactiveStorageDeciderService.java#L79-L83
[predict]: https://github.com/elastic/elasticsearch/blob/v8.13.2/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/storage/ProactiveStorageDeciderService.java#L85-L95

There are several more Decider Services, implementing the `AutoscalingDeciderService` interface.

# Snapshot / Restore

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ Returns information about all stored connector sync jobs ordered by their creati
(Optional, integer) The offset from the first result to fetch. Defaults to `0`.

`status`::
(Optional, job status) The job status the fetched sync jobs need to have.
(Optional, job status) A comma-separated list of job statuses to filter the results. Available statuses include: `canceling`, `canceled`, `completed`, `error`, `in_progress`, `pending`, `suspended`.

`connector_id`::
(Optional, string) The connector id the fetched sync jobs need to have.

`job_type`::
(Optional, job type) A comma-separated list of job types.
(Optional, job type) A comma-separated list of job types. Available job types are: `full`, `incremental` and `access_control`.

[[list-connector-sync-jobs-api-example]]
==== {api-examples-title}
Expand Down
2 changes: 2 additions & 0 deletions docs/reference/mapping/types/nested.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ independently of each other.
TIP: When ingesting key-value pairs with a large, arbitrary set of keys, you might consider modeling each key-value pair as its own nested document with `key` and `value` fields. Instead, consider using the <<flattened,flattened>> data type, which maps an entire object as a single field and allows for simple searches over its contents.
Nested documents and queries are typically expensive, so using the `flattened` data type for this use case is a better option.

WARNING: Nested fields have incomplete support in Kibana. While they are visible and searchable in Discover, they cannot be used to build visualizations in Lens.

[[nested-arrays-flattening-objects]]
==== How arrays of objects are flattened

Expand Down
4 changes: 4 additions & 0 deletions docs/reference/rest-api/security/create-roles.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ privilege or action.
`cluster`:: (list) A list of cluster privileges. These privileges define the
cluster level actions that users with this role are able to execute.

`description`:: (string) A description of the role.
The maximum length is `1000` chars.

`global`:: (object) An object defining global privileges. A global privilege is
a form of cluster privilege that is request-aware. Support for global privileges
is currently limited to the management of application privileges.
Expand Down Expand Up @@ -104,6 +107,7 @@ The following example adds a role called `my_admin_role`:
--------------------------------------------------
POST /_security/role/my_admin_role
{
"description": "Grants full access to all management features within the cluster.",
"cluster": ["all"],
"indices": [
{
Expand Down
1 change: 1 addition & 0 deletions docs/reference/rest-api/security/get-roles.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ GET /_security/role/my_admin_role
--------------------------------------------------
{
"my_admin_role": {
"description": "Grants full access to all management features within the cluster.",
"cluster" : [ "all" ],
"indices" : [
{
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/security/authorization/privileges.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ All {Ilm} operations related to managing policies.
`manage_index_templates`::
All operations on index templates.

`manage_inference`::
All operations related to managing {infer}.

`manage_ingest_pipelines`::
All operations on ingest pipelines.

Expand Down Expand Up @@ -192,6 +195,9 @@ node info, node and cluster stats, and pending cluster tasks.
`monitor_enrich`::
All read-only operations related to managing and executing enrich policies.

`monitor_inference`::
All read-only operations related to {infer}.

`monitor_ml`::
All read-only {ml} operations, such as getting information about {dfeeds}, jobs,
model snapshots, or results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ public float score(int firstOrd, int secondOrd) throws IOException {

if (firstSeg != null && secondSeg != null) {
int dotProduct = dotProduct7u(firstSeg, secondSeg, length);
assert dotProduct >= 0;
float adjustedDistance = dotProduct * scoreCorrectionConstant + firstOffset + secondOffset;
return (1 + adjustedDistance) / 2;
return Math.max((1 + adjustedDistance) / 2, 0f);
} else {
return fallbackScore(firstByteOffset, secondByteOffset);
return Math.max(fallbackScore(firstByteOffset, secondByteOffset), 0f);
}
}
}
Loading

0 comments on commit 78f894d

Please sign in to comment.