Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into source_loader_with_…
Browse files Browse the repository at this point in the history
…filters
  • Loading branch information
jimczi committed Oct 2, 2024
2 parents 8450a98 + e9656d9 commit abfb1d5
Show file tree
Hide file tree
Showing 559 changed files with 6,110 additions and 2,161 deletions.
1 change: 0 additions & 1 deletion .buildkite/pipelines/periodic-packaging.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ steps:
matrix:
setup:
image:
- centos-7
- debian-11
- opensuse-leap-15
- oraclelinux-7
Expand Down
1 change: 0 additions & 1 deletion .buildkite/pipelines/periodic-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ steps:
matrix:
setup:
image:
- centos-7
- debian-11
- opensuse-leap-15
- oraclelinux-7
Expand Down
1 change: 0 additions & 1 deletion .buildkite/pipelines/periodic-platform-support.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ steps:
matrix:
setup:
image:
- centos-7
- debian-11
- opensuse-leap-15
- oraclelinux-7
Expand Down
3 changes: 0 additions & 3 deletions .buildkite/pipelines/pull-request/packaging-tests-unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ steps:
matrix:
setup:
image:
- centos-7
- debian-11
- opensuse-leap-15
- oraclelinux-7
Expand Down Expand Up @@ -38,7 +37,6 @@ steps:
matrix:
setup:
image:
- centos-7
- debian-11
- opensuse-leap-15
- oraclelinux-7
Expand Down Expand Up @@ -66,7 +64,6 @@ steps:
matrix:
setup:
image:
- centos-7
- debian-11
- opensuse-leap-15
- oraclelinux-7
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/docs-preview-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ on:
pull_request_target:
types: [opened]
paths:
- '**.asciidoc'
- "**.asciidoc"

jobs:
doc-preview:
if: github.repository == 'elastic/elasticsearch'
permissions:
pull-requests: write
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ permissions:
jobs:
validation:
name: "Validation"
if: github.repository == 'elastic/elasticsearch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/sync-main-to-jdk-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
name: "Merge main to openjdk23-bundle branch"
on:
schedule:
- cron: '30 17 * * *'
- cron: "30 17 * * *"
workflow_dispatch: {}

jobs:
merge-branch:
if: github.repository == 'elastic/elasticsearch'
runs-on: ubuntu-latest
steps:
- name: checkout
Expand All @@ -15,6 +16,6 @@ jobs:
- name: merge
uses: devmasx/[email protected]
with:
type: 'now'
type: "now"
target_branch: openjdk23-bundle
github_token: ${{ secrets.ELASTICSEARCHMACHINE_TOKEN }}
3 changes: 2 additions & 1 deletion .github/workflows/updatecli-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ name: updatecli-compose
on:
workflow_dispatch:
schedule:
- cron: '0 6 * * *'
- cron: "0 6 * * *"

permissions:
contents: read

jobs:
compose:
if: github.repository == 'elastic/elasticsearch'
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down
100 changes: 40 additions & 60 deletions README.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ https://www.elastic.co/downloads/elasticsearch[elastic.co/downloads/elasticsearc
=== Run Elasticsearch locally

////
IMPORTANT: This content is replicated in the Elasticsearch guide. See `run-elasticsearch-locally.asciidoc`.
Both will soon be replaced by a quickstart script.
////
IMPORTANT: This content is replicated in the Elasticsearch repo. See `run-elasticsearch-locally.asciidoc`.
Ensure both files are in sync.
https://github.com/elastic/start-local is the source of truth.
////

[WARNING]
====
Expand All @@ -44,89 +46,67 @@ DO NOT USE THESE INSTRUCTIONS FOR PRODUCTION DEPLOYMENTS.
This setup is intended for local development and testing only.
====

The following commands help you very quickly spin up a single-node Elasticsearch cluster, together with Kibana in Docker.
Use this setup for local development or testing.
Quickly set up Elasticsearch and Kibana in Docker for local development or testing, using the https://github.com/elastic/start-local?tab=readme-ov-file#-try-elasticsearch-and-kibana-locally[`start-local` script].

==== Prerequisites
ℹ️ For more detailed information about the `start-local` setup, refer to the https://github.com/elastic/start-local[README on GitHub].

If you don't have Docker installed, https://www.docker.com/products/docker-desktop[download and install Docker Desktop] for your operating system.
==== Prerequisites

==== Set environment variables
- If you don't have Docker installed, https://www.docker.com/products/docker-desktop[download and install Docker Desktop] for your operating system.
- If you're using Microsoft Windows, then install https://learn.microsoft.com/en-us/windows/wsl/install[Windows Subsystem for Linux (WSL)].

Configure the following environment variables.
==== Trial license

[source,sh]
----
export ELASTIC_PASSWORD="<ES_PASSWORD>" # password for "elastic" username
export KIBANA_PASSWORD="<KIB_PASSWORD>" # Used internally by Kibana, must be at least 6 characters long
----
This setup comes with a one-month trial of the Elastic *Platinum* license.
After the trial period, the license reverts to *Free and open - Basic*.
Refer to https://www.elastic.co/subscriptions[Elastic subscriptions] for more information.

==== Create a Docker network
==== Run `start-local`

To run both Elasticsearch and Kibana, you'll need to create a Docker network:
To set up Elasticsearch and Kibana locally, run the `start-local` script:

[source,sh]
----
docker network create elastic-net
curl -fsSL https://elastic.co/start-local | sh
----
// NOTCONSOLE

==== Run Elasticsearch
This script creates an `elastic-start-local` folder containing configuration files and starts both Elasticsearch and Kibana using Docker.

Start the Elasticsearch container with the following command:
After running the script, you can access Elastic services at the following endpoints:

[source,sh]
----
docker run -p 127.0.0.1:9200:9200 -d --name elasticsearch --network elastic-net \
-e ELASTIC_PASSWORD=$ELASTIC_PASSWORD \
-e "discovery.type=single-node" \
-e "xpack.security.http.ssl.enabled=false" \
-e "xpack.license.self_generated.type=trial" \
docker.elastic.co/elasticsearch/elasticsearch:{version}
----
* *Elasticsearch*: http://localhost:9200
* *Kibana*: http://localhost:5601

==== Run Kibana (optional)
The script generates a random password for the `elastic` user, which is displayed at the end of the installation and stored in the `.env` file.

To run Kibana, you must first set the `kibana_system` password in the Elasticsearch container.
[CAUTION]
====
This setup is for local testing only. HTTPS is disabled, and Basic authentication is used for Elasticsearch. For security, Elasticsearch and Kibana are accessible only through `localhost`.
====

[source,sh]
----
# configure the Kibana password in the ES container
curl -u elastic:$ELASTIC_PASSWORD \
-X POST \
http://localhost:9200/_security/user/kibana_system/_password \
-d '{"password":"'"$KIBANA_PASSWORD"'"}' \
-H 'Content-Type: application/json'
----
// NOTCONSOLE
==== API access

Start the Kibana container with the following command:
An API key for Elasticsearch is generated and stored in the `.env` file as `ES_LOCAL_API_KEY`.
Use this key to connect to Elasticsearch with a https://www.elastic.co/guide/en/elasticsearch/client/index.html[programming language client] or the https://www.elastic.co/guide/en/elasticsearch/reference/current/rest-apis.html[REST API].

From the `elastic-start-local` folder, check the connection to Elasticsearch using `curl`:

[source,sh]
----
source .env
curl $ES_LOCAL_URL -H "Authorization: ApiKey ${ES_LOCAL_API_KEY}"
----
docker run -p 127.0.0.1:5601:5601 -d --name kibana --network elastic-net \
-e ELASTICSEARCH_URL=http://elasticsearch:9200 \
-e ELASTICSEARCH_HOSTS=http://elasticsearch:9200 \
-e ELASTICSEARCH_USERNAME=kibana_system \
-e ELASTICSEARCH_PASSWORD=$KIBANA_PASSWORD \
-e "xpack.security.enabled=false" \
-e "xpack.license.self_generated.type=trial" \
docker.elastic.co/kibana/kibana:{version}
----

.Trial license
[%collapsible]
====
The service is started with a trial license. The trial license enables all features of Elasticsearch for a trial period of 30 days. After the trial period expires, the license is downgraded to a basic license, which is free forever. If you prefer to skip the trial and use the basic license, set the value of the `xpack.license.self_generated.type` variable to basic instead. For a detailed feature comparison between the different licenses, refer to our https://www.elastic.co/subscriptions[subscriptions page].
====
// NOTCONSOLE

==== Send requests to Elasticsearch
=== Send requests to Elasticsearch

You send data and other requests to Elasticsearch through REST APIs.
You can interact with Elasticsearch using any client that sends HTTP requests,
such as the https://www.elastic.co/guide/en/elasticsearch/client/index.html[Elasticsearch
language clients] and https://curl.se[curl].

===== Using curl
==== Using curl

Here's an example curl command to create a new Elasticsearch index, using basic auth:

Expand All @@ -139,7 +119,7 @@ curl -u elastic:$ELASTIC_PASSWORD \
----
// NOTCONSOLE

===== Using a language client
==== Using a language client

To connect to your local dev Elasticsearch cluster with a language client, you can use basic authentication with the `elastic` username and the password you set in the environment variable.

Expand Down Expand Up @@ -167,7 +147,7 @@ client = Elasticsearch(
print(client.info())
----

===== Using the Dev Tools Console
==== Using the Dev Tools Console

Kibana's developer console provides an easy way to experiment and test requests.
To access the console, open Kibana, then go to **Management** > **Dev Tools**.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.elasticsearch.gradle.VersionProperties;
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransform;
import org.elasticsearch.gradle.internal.test.rest.transform.RestTestTransformer;
import org.elasticsearch.gradle.internal.test.rest.transform.close_to.ReplaceValueInCloseTo;
import org.elasticsearch.gradle.internal.test.rest.transform.do_.ReplaceKeyInDo;
import org.elasticsearch.gradle.internal.test.rest.transform.headers.InjectHeaders;
import org.elasticsearch.gradle.internal.test.rest.transform.length.ReplaceKeyInLength;
Expand Down Expand Up @@ -253,7 +254,30 @@ public void replaceKeyInMatch(String oldKeyName, String newKeyName) {
}

/**
* Replaces all the values of a is_true assertion for all project REST tests.
* Replaces the value of the `value` of a close_to assertion for a given REST tests.
* For example: close_to: { get.fields._routing: { value: 5.1, error: 0.00001 } }
* to close_to: { get.fields._routing: { value: 9.5, error: 0.00001 } }
* @param subKey the key name directly under close_to to replace. For example "get.fields._routing"
* @param newValue the value used in the replacement. For example 9.5
* @param testName the testName to apply replacement
*/
public void replaceValueInCloseTo(String subKey, double newValue, String testName) {
getTransformations().add(new ReplaceValueInCloseTo(subKey, MAPPER.convertValue(newValue, NumericNode.class), testName));
}

/**
* Replaces the value of the `value` of a close_to assertion for all project REST tests.
* For example: close_to: { get.fields._routing: { value: 5.1, error: 0.00001 } }
* to close_to: { get.fields._routing: { value: 9.5, error: 0.00001 } }
* @param subKey the key name directly under close_to to replace. For example "get.fields._routing"
* @param newValue the value used in the replacement. For example 9.5
*/
public void replaceValueInCloseTo(String subKey, double newValue) {
getTransformations().add(new ReplaceValueInCloseTo(subKey, MAPPER.convertValue(newValue, NumericNode.class)));
}

/**
* Replaces all the values of is_true assertion for all project REST tests.
* For example "is_true": "value_to_replace" to "is_true": "value_replaced"
*
* @param oldValue the value that has to match and will be replaced
Expand All @@ -263,6 +287,18 @@ public void replaceIsTrue(String oldValue, Object newValue) {
getTransformations().add(new ReplaceIsTrue(oldValue, MAPPER.convertValue(newValue, TextNode.class)));
}

/**
* Replaces all the values of is_true assertion for given REST test.
* For example "is_true": "value_to_replace" to "is_true": "value_replaced"
*
* @param oldValue the value that has to match and will be replaced
* @param newValue the value used in the replacement
* @param testName the testName to apply replacement
*/
public void replaceIsTrue(String oldValue, Object newValue, String testName) {
getTransformations().add(new ReplaceIsTrue(oldValue, MAPPER.convertValue(newValue, TextNode.class), testName));
}

/**
* Replaces all the values of a is_false assertion for all project REST tests.
* For example "is_false": "value_to_replace" to "is_false": "value_replaced"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

package org.elasticsearch.gradle.internal.test.rest.transform.close_to;

import com.fasterxml.jackson.databind.node.NumericNode;
import com.fasterxml.jackson.databind.node.ObjectNode;

import org.elasticsearch.gradle.internal.test.rest.transform.ReplaceByKey;
import org.gradle.api.tasks.Internal;

/**
* Replaces the value of the `value` of a close_to assertion for a given sub-node.
* For example: close_to: { get.fields._routing: { value: 5.1, error: 0.00001 } }
* to close_to: { get.fields._routing: { value: 9.5, error: 0.00001 } }
*/
public class ReplaceValueInCloseTo extends ReplaceByKey {

public ReplaceValueInCloseTo(String replaceKey, NumericNode replacementNode) {
this(replaceKey, replacementNode, null);
}

public ReplaceValueInCloseTo(String replaceKey, NumericNode replacementNode, String testName) {
super(replaceKey, replaceKey, replacementNode, testName);
}

@Override
@Internal
public String getKeyToFind() {
return "close_to";
}

@Override
public void transformTest(ObjectNode matchParent) {
ObjectNode closeToNode = (ObjectNode) matchParent.get(getKeyToFind());
ObjectNode subNode = (ObjectNode) closeToNode.get(requiredChildKey());
subNode.remove("value");
subNode.set("value", getReplacementNode());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ public class ReplaceIsTrue extends ReplaceTextual {
public ReplaceIsTrue(String valueToBeReplaced, TextNode replacementNode) {
super("is_true", valueToBeReplaced, replacementNode);
}

public ReplaceIsTrue(String valueToBeReplaced, TextNode replacementNode, String testName) {
super("is_true", valueToBeReplaced, replacementNode, testName);
}
}
Loading

0 comments on commit abfb1d5

Please sign in to comment.