Skip to content

Commit 1900bc3

Browse files
authored
Merge branch 'main' into cps-transform-6
2 parents 2f41434 + 4c8ac0b commit 1900bc3

File tree

852 files changed

+54312
-5751
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

852 files changed

+54312
-5751
lines changed

.github/CODEOWNERS

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,28 @@ server/src/main/java/org/elasticsearch/common/xcontent @elastic/es-core-infra
9999
# Security
100100
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/privilege @elastic/es-security
101101
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/store/ReservedRolesStore.java @elastic/es-security
102+
103+
# Docs team
104+
docs/README.md @elastic/core-docs
105+
docs/Versions.asciidoc @elastic/core-docs
106+
docs/*.yml @elastic/core-docs
107+
docs/community-clients @elastic/core-docs
108+
docs/release-notes @elastic/core-docs
109+
docs/extend @elastic/admin-docs
110+
docs/java-rest @elastic/dev-docs
111+
docs/reference @elastic/core-docs
112+
docs/reference/aggregations @elastic/dev-docs
113+
docs/reference/community-contributed @elastic/dev-docs
114+
docs/reference/elasticsearch/command-line-tools @elastic/admin-docs
115+
docs/reference/elasticsearch/index-lifecycle-actions @elastic/dev-docs
116+
docs/reference/elasticsearch/mapping-reference @elastic/dev-docs
117+
docs/reference/elasticsearch/rest-apis @elastic/dev-docs
118+
docs/reference/elasticsearch/elasticsearch-audit-events.md @elastic/admin-docs
119+
docs/reference/elasticsearch/jvm-settings.md @elastic/admin-docs
120+
docs/reference/elasticsearch/roles.md @elastic/admin-docs
121+
docs/reference/enrich-processor @elastic/admin-docs
122+
docs/reference/query-languages @elastic/dev-docs
123+
docs/reference/scripting-languages @elastic/admin-docs
124+
docs/reference/search-connectors @elastic/dev-docs
125+
docs/reference/setup/install/docker @elastic/admin-docs
126+
docs/reference/text-analysis @elastic/dev-docs

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# claude
33
.claude
44

5+
# cursor
6+
.cursorrules
7+
58
# JetBrainsAI/Junie
69
.junie/
710

AGENTS.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Elasticsearch
2+
3+
## Toolchain Snapshot
4+
- **Java**: JDK 25 via `JAVA_HOME`; use the bundled Gradle wrapper (`./gradlew`).
5+
- **Build tooling**: Gradle composite build with `build-conventions`, `build-tools`, and `build-tools-internal`; Docker is required for some packaging/tests.
6+
- **OS packages**: Packaging and QA jobs expect ephemeral hosts; do not run packaging suites on your workstation.
7+
- **Security**: Default dev clusters enable security; use `elastic-admin:elastic-password` or disable with `-Dtests.es.xpack.security.enabled=false`.
8+
- **Cursor/Copilot rules**: None provided in repo; follow this guide plus CONTRIBUTING.md.
9+
10+
## Build & Run Commands
11+
- Refer to CONTRIBUTING.md & TESTING.asciidoc for comprehensive build/test instructions.
12+
13+
## Verification & Lint Tasks
14+
- `./gradlew spotlessJavaCheck` / `spotlessApply` (or `:server:spotlessJavaCheck`): enforce formatter profile in `build-conventions/formatterConfig.xml`.
15+
16+
## Project Structure
17+
The repository is organized into several key directories:
18+
* `server`: The core Elasticsearch server.
19+
* `modules`: Features shipped with Elasticsearch by default.
20+
* `plugins`: Officially supported plugins.
21+
* `libs`: Internal libraries used by other parts of the project.
22+
* `qa`: Integration and multi-version tests.
23+
* `docs`: Project documentation.
24+
* `distribution`: Logic for building distribution packages.
25+
* `x-pack`: Additional code modules and plugins under Elastic License.
26+
* `build-conventions`, `build-tools`, `build-tools-internal`: Gradle build logic.
27+
28+
## Testing Cheatsheet
29+
- Standard suite: `./gradlew test` (respects cached results; add `-Dtests.timestamp=$(date +%s)` to bypass caches when reusing seeds).
30+
- Single project: `./gradlew :server:test` (or other subproject path).
31+
- Single class: `./gradlew :server:test --tests org.elasticsearch.package.ClassName`.
32+
- Single package: `./gradlew :server:test --tests 'org.elasticsearch.package.*'`.
33+
- Single method / repeated runs: `./gradlew :server:test --tests org.elasticsearch.package.ClassName.methodName -Dtests.iters=N`.
34+
- Deterministic seed: append `-Dtests.seed=DEADBEEF` (each method uses derived seeds).
35+
- JVM tuning knobs: `-Dtests.jvms=8`, `-Dtests.heap.size=4G`, `-Dtests.jvm.argline="-verbose:gc"`, `-Dtests.output=always`, etc.
36+
- Debugging: append `--debug-jvm` to the Gradle test task and attach a debugger on port 5005.
37+
- CI reproductions: copy the `REPRODUCE WITH` line from CI logs; it includes project path, seed, and JVM flags.
38+
- Yaml REST tests: `./gradlew ":rest-api-spec:yamlRestTest" --tests "org.elasticsearch.test.rest.ClientYamlTestSuiteIT.test {yaml=<relative_test_file_path>}"`
39+
- Use the Elasticsearch testing framework where possible for unit and yaml tests and be consistent in style with other elasticsearch tests.
40+
- Use real classes over mocks or stubs for unit tests, unless the real class is complex then either a simplified subclass should be created within the test or, as a last resort, a mock or stub can be used. Unit tests must be as close to real-world scenarios as possible.
41+
- Ensure mocks or stubs are well-documented and clearly indicate why they were necessary.
42+
43+
### Test Types
44+
- Unit Tests: Preferred. Extend `ESTestCase`.
45+
- Single Node: Extend `ESSingleNodeTestCase` (lighter than full integ test).
46+
- Integration: Extend `ESIntegTestCase`.
47+
- REST API: Extend `ESRestTestCase` or `ESClientYamlSuiteTestCase`. **YAML based REST tests are preferred** for integration/API testing.
48+
49+
## Dependency Hygiene
50+
- Never add a dependency without checking for existing alternatives in the repo.
51+
52+
## Formatting & Imports
53+
- Absolutely no wildcard imports; keep existing import order and avoid reordering untouched lines.
54+
55+
## Types, Generics, and Suppressions
56+
- Prefer type-safe constructs; avoid raw types and unchecked casts.
57+
- If suppressing warnings, scope `@SuppressWarnings` narrowly (ideally a single statement or method).
58+
- Document non-obvious casts or type assumptions via Javadoc/comments for reviewers.
59+
60+
## Naming Conventions
61+
- REST handlers typically use the `Rest*Action` pattern; transport-layer handlers mirror them with `Transport*Action` classes.
62+
- REST classes expose routes via `RestHandler#routes`; when adding endpoints ensure naming matches existing REST/Transport patterns to aid discoverability.
63+
- Transport `ActionType` strings encode scope (`indices:data/read/...`, `cluster:admin/...`, etc.); align new names with these conventions to integrate with privilege resolution.
64+
65+
## Logging & Error Handling
66+
- Elasticsearch should prefer its own logger `org.elasticsearch.logging.LogManager` & `org.elasticsearch.logging.Logger`; declare `private static final Logger logger = LogManager.getLogger(Class.class)`.
67+
- Always use parameterized logging (`logger.debug("operation [{}]", value)`); never build strings via concatenation.
68+
- Wrap expensive log-message construction in `() -> Strings.format(...)` suppliers when logging at `TRACE`/`DEBUG` to avoid unnecessary work.
69+
- Log levels:
70+
- `TRACE`: highly verbose developer diagnostics; usually read alongside code.
71+
- `DEBUG`: detailed production troubleshooting; ensure volume is bounded.
72+
- `INFO`: default-enabled operational milestones; prefer factual language.
73+
- `WARN`: actionable problems users must investigate; include context and, if needed, exception stack traces.
74+
- `ERROR`: reserve for unrecoverable states (e.g., storage health failures); prefer `WARN` otherwise.
75+
- Only log client-caused exceptions when the cluster admin can act on them; otherwise rely on API responses.
76+
- Tests can assert logging via `MockLog` for complex flows.
77+
78+
## Javadoc & Comments
79+
- New packages/classes/public or abstract methods require Javadoc explaining the "why" rather than the implementation details.
80+
- Avoid documenting trivial getters/setters; focus on behavior, preconditions, or surprises.
81+
- For tests, Javadoc can describe scenario setup/expectations to aid future contributors.
82+
- Do not remove existing comments from code unless the code is also being removed or the comment has become incorrect.
83+
84+
## License Headers
85+
- Default header (outside `x-pack`): Elastic License 2.0, SSPL v1, or AGPL v3—they are already codified at the top of Java files; copy from existing sources.
86+
- Files under `x-pack` require the Elastic License 2.0-only header; IDEs configured per CONTRIBUTING.md can insert correct text automatically.
87+
88+
## Best Practices for Automation Agents
89+
- Never edit unrelated files; keep diffs tightly scoped to the task at hand.
90+
- Prefer Gradle tasks over ad-hoc scripts.
91+
- When scripting CLI sequences, leverage `gradlew` task.
92+
- Unrecognized changes: assume other agent; keep going; focus your changes. If it causes issues, stop + ask user.
93+
- Do not add "Co-Authored-By" lines to commit messages. commit messages should adhere to the 50/72 rule: use a maximum of 50 columns for the commit summary
94+
95+
## Backwards compatibility
96+
- For changes to a `Writeable` implementation (`writeTo` and constructor from `StreamInput`), add a new `public static final <UNIQUE_DESCRIPTIVE_NAME> = TransportVersion.fromName("<unique_descriptive_name>")` and use it in the new code paths. Confirm the backport branches and then generate a new version file with `./gradlew generateTransportVersion`.
97+
98+
Stay aligned with `CONTRIBUTING.md`, `BUILDING.md`, and `TESTING.asciidoc`; this AGENTS guide summarizes—but does not replace—those authoritative docs.

CONTRIBUTING.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,8 @@ Please follow these formatting guidelines:
274274
consistency.
275275
* Note that Javadoc and block comments i.e. `/* ... */` are not formatted,
276276
but line comments i.e. `// ...` are.
277-
* Negative boolean expressions must use the form `foo == false` instead of
278-
`!foo` for better readability of the code. This is enforced via
279-
Checkstyle. Conversely, you should not write e.g. `if (foo == true)`, but
280-
just `if (foo)`.
277+
* Negative boolean expressions should use the form `foo == false` instead of
278+
`!foo` where this improves readability. Conversely, you should not write e.g. `if (foo == true)`, but just `if (foo)`.
281279

282280
#### Editor / IDE support
283281

benchmarks/src/main/java/org/elasticsearch/benchmark/_nightly/esql/ValuesSourceReaderBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
import org.elasticsearch.compute.data.Page;
4444
import org.elasticsearch.compute.lucene.AlwaysReferencedIndexedByShardId;
4545
import org.elasticsearch.compute.lucene.IndexedByShardIdFromSingleton;
46-
import org.elasticsearch.compute.lucene.LuceneSourceOperator;
46+
import org.elasticsearch.compute.lucene.query.LuceneSourceOperator;
4747
import org.elasticsearch.compute.lucene.read.ValuesSourceReaderOperator;
4848
import org.elasticsearch.compute.lucene.read.ValuesSourceReaderOperatorStatus;
4949
import org.elasticsearch.compute.operator.DriverContext;

build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/ElasticsearchTestBasePluginFuncTest.groovy

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,10 @@ class ElasticsearchTestBasePluginFuncTest extends AbstractGradleFuncTest {
152152
"""
153153

154154
when:
155-
def result1 = gradleRunner("cleanTest", "cleanTest2", "test", "test2").build()
156-
def result2 = gradleRunner("cleanTest", "cleanTest2", "test", "test2").build()
155+
// Avoid invoking cleanTest* on Windows; it can flake due to file handle timing when deleting build/test-results/**/binary.
156+
// We still need two consecutive task executions to observe two different seeds while reusing the configuration cache.
157+
def result1 = gradleRunner("test", "test2", "--rerun-tasks").build()
158+
def result2 = gradleRunner("test", "test2", "--rerun-tasks").build()
157159

158160
then:
159161
def seeds1 = result1.output.findAll(/(?m)TESTSEED=\[([^\]]+)\]/) { it[1] }

build-tools-internal/src/main/resources/checkstyle.xml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -187,18 +187,6 @@
187187
<message key="descendant.token.max" value="Do not check for equality with 'true', since it is implied" />
188188
</module>
189189

190-
<!-- Forbid using '!' for logical negations in favour of checking against 'false' explicitly. -->
191-
<!-- This is only reported in the IDE for now because there are many violations -->
192-
<module name="DescendantToken">
193-
<property name="id" value="BooleanNegation" />
194-
<property name="tokens" value="EXPR"/>
195-
<property name="limitedTokens" value="LNOT"/>
196-
<property name="maximumNumber" value="0"/>
197-
<message
198-
key="descendant.token.max"
199-
value="Do not negate boolean expressions with '!', but check explicitly with '== false' as it is more explicit"/>
200-
</module>
201-
202190
<module name="NeedBraces">
203191
<!-- We have many generated equals classes with LITERAL_IF and no braces, so we don't check IF or ELSE -->
204192
<property name="tokens" value="LITERAL_DO,LITERAL_FOR,LITERAL_WHILE"/>

build-tools-internal/version.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ elasticsearch = 9.4.0
22
lucene = 10.3.2
33

44
bundled_jdk_vendor = openjdk
5-
bundled_jdk = 25.0.1+8@2fbf10d8c78e40bd87641c434705079d
5+
bundled_jdk = 25.0.2+10@b1e0dfa218384cb9959bdcb897162d4e
66
# optional dependencies
77
spatial4j = 0.7
88
jts = 1.20.0
@@ -24,6 +24,7 @@ cuvs_java = 25.12.0
2424
ldapsdk = 7.0.3
2525

2626
antlr4 = 4.13.1
27+
iceberg = 1.10.1
2728
# bouncy castle version for non-fips. fips jars use a different version
2829
bouncycastle=1.79
2930
# used by security and idp (need to be in sync due to cross-dependency in testing)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Local Prometheus -> Elasticsearch remote_write
2+
3+
This setup runs Prometheus and Kibana in Docker and starts Elasticsearch from source.
4+
Prometheus scrapes itself and forwards samples to Elasticsearch via the Prometheus remote write endpoint.
5+
6+
## Files
7+
8+
- `prometheus.yml` configures `scrape_configs` and `remote_write`.
9+
- `docker-compose.yml` runs Prometheus on port `9090` and Kibana on port `5601`.
10+
11+
## Start
12+
13+
Start Elasticsearch from source and ensure it listens on a non-loopback interface
14+
so that Prometheus in Docker can reach it.
15+
16+
```bash
17+
./gradlew run --configuration-cache \
18+
-Dtests.es.http.host=0.0.0.0 \
19+
-Dtests.es.xpack.ml.enabled=false \
20+
-Drun.license_type=trial \
21+
-Dtests.heap.size=4G \
22+
-Dtests.jvm.argline="-da -dsa -Dio.netty.leakDetection.level=simple"
23+
```
24+
25+
```bash
26+
cd dev-tools/prometheus-local
27+
docker compose up -d
28+
```
29+
30+
## Verify
31+
32+
- Prometheus UI: `http://localhost:9090`
33+
- Targets page: `http://localhost:9090/targets` (the `prometheus` job should be `UP`)
34+
- Kibana UI: `http://localhost:5601`
35+
- Remote write health in Prometheus UI (example query):
36+
- `rate(prometheus_remote_storage_samples_total[1m])`
37+
- Query PromQL in Kibana Discover (example query):
38+
- `PROMQL step=1m rate(prometheus_remote_storage_samples_total[1m])`
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
services:
2+
prometheus:
3+
image: prom/prometheus:latest
4+
container_name: es-local-prometheus
5+
ports:
6+
- "9090:9090"
7+
volumes:
8+
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
9+
- prometheus_data:/prometheus
10+
command:
11+
- "--config.file=/etc/prometheus/prometheus.yml"
12+
- "--storage.tsdb.path=/prometheus"
13+
- "--web.enable-lifecycle"
14+
restart: unless-stopped
15+
kibana_settings:
16+
image: curlimages/curl:latest
17+
container_name: kibana-settings
18+
restart: 'no'
19+
command:
20+
- /bin/sh
21+
- -c
22+
- |
23+
echo "Setup kibana_system password"
24+
start_time=$$(date +%s)
25+
timeout=60
26+
until curl -s -u "elastic:password" -X POST "http://host.docker.internal:9200/_security/user/kibana_system/_password" \
27+
-H "Content-Type: application/json" \
28+
-d "{\"password\":\"password\"}" | grep -q "^{}"; do
29+
if [ $$(($$(date +%s) - $$start_time)) -ge $$timeout ]; then
30+
echo "Error: Elasticsearch timeout while setting kibana_system password"
31+
exit 1
32+
fi
33+
sleep 2
34+
done
35+
kibana:
36+
depends_on:
37+
kibana_settings:
38+
condition: service_completed_successfully
39+
image: docker.elastic.co/kibana/kibana:9.4.0-SNAPSHOT
40+
container_name: es-local-kibana
41+
ports:
42+
- "5601:5601"
43+
environment:
44+
SERVER_NAME: kibana
45+
ELASTICSEARCH_HOSTS: http://host.docker.internal:9200
46+
ELASTICSEARCH_USERNAME: kibana_system
47+
ELASTICSEARCH_PASSWORD: password
48+
SERVER_HOST: "0.0.0.0"
49+
XPACK_SECURITY_ENABLED: "false"
50+
XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY: "prometheus-local-eso-encryption-key-32"
51+
ELASTICSEARCH_PUBLICBASEURL: http://host.docker.internal:9200
52+
XPACK_SPACES_DEFAULTSOLUTION: "oblt"
53+
restart: unless-stopped
54+
55+
volumes:
56+
prometheus_data:

0 commit comments

Comments
 (0)