Skip to content

Commit c4f898c

Browse files
authored
Merge branch 'main' into mw-synthetic
2 parents d87d13d + 6f27ac8 commit c4f898c

File tree

177 files changed

+7039
-1844
lines changed

Some content is hidden

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

177 files changed

+7039
-1844
lines changed

distribution/docker/src/docker/dockerfiles/default/Dockerfile

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,20 @@ RUN microdnf install -y findutils tar gzip
2929
# The tini GitHub page gives instructions for verifying the binary using
3030
# gpg, but the keyservers are slow to return the key and this can fail the
3131
# build. Instead, we check the binary against the published checksum.
32-
RUN set -eux ; \\
33-
tini_bin="" ; \\
34-
arch="\$(rpm --query --queryformat='%{ARCH}' rpm)"; \
35-
case "\$(arch)" in \\
36-
aarch64) tini_bin='tini-arm64' ;; \\
37-
x86_64) tini_bin='tini-amd64' ;; \\
38-
*) echo >&2 ; echo >&2 "Unsupported architecture \$arch" ; echo >&2 ; exit 1 ;; \\
32+
RUN set -eux; \\
33+
arch="\$(rpm --query --queryformat='%{ARCH}' rpm)"; \\
34+
case "\$arch" in \\
35+
aarch64) tini_bin='tini-arm64'; tini_sum='07952557df20bfd2a95f9bef198b445e006171969499a1d361bd9e6f8e5e0e81' ;; \\
36+
x86_64) tini_bin='tini-amd64'; tini_sum='93dcc18adc78c65a028a84799ecf8ad40c936fdfc5f2a57b1acda5a8117fa82c' ;; \\
37+
*) echo >&2 "Unsupported architecture \$arch"; exit 1 ;; \\
3938
esac ; \\
40-
curl -f --retry 10 -S -L -O https://github.com/krallin/tini/releases/download/v0.19.0/\${tini_bin} ; \\
41-
curl -f --retry 10 -S -L -O https://github.com/krallin/tini/releases/download/v0.19.0/\${tini_bin}.sha256sum ; \\
42-
sha256sum -c \${tini_bin}.sha256sum ; \\
43-
rm \${tini_bin}.sha256sum ; \\
44-
mv \${tini_bin} /bin/tini ; \\
39+
curl -f --retry 10 -S -L -o /tmp/tini https://github.com/krallin/tini/releases/download/v0.19.0/\${tini_bin}; \\
40+
echo "\${tini_sum} /tmp/tini" | sha256sum -c -; \\
41+
mv /tmp/tini /bin/tini; \\
4542
chmod 0555 /bin/tini
4643
4744
WORKDIR /usr/share/elasticsearch
48-
RUN arch="\$(rpm --query --queryformat='%{ARCH}' rpm)" && curl -f --retry 10 -S -L --output /tmp/elasticsearch.tar.gz https://artifacts-no-kpi.elastic.co/downloads/elasticsearch/elasticsearch-${version}-linux-\$(arch).tar.gz
45+
RUN arch="\$(rpm --query --queryformat='%{ARCH}' rpm)" && curl -f --retry 10 -S -L --output /tmp/elasticsearch.tar.gz https://artifacts-no-kpi.elastic.co/downloads/elasticsearch/elasticsearch-${version}-linux-\$arch.tar.gz
4946
RUN tar -zxf /tmp/elasticsearch.tar.gz --strip-components=1 && \\
5047
# Configure the distribution for Docker
5148
sed -i -e 's/ES_DISTRIBUTION_TYPE=tar/ES_DISTRIBUTION_TYPE=docker/' bin/elasticsearch-env && \\
@@ -111,12 +108,10 @@ ENV SHELL=/bin/bash
111108
COPY --chmod=0555 bin/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
112109

113110
RUN chmod g=u /etc/passwd && \\
114-
chmod 0555 /usr/local/bin/docker-entrypoint.sh && \\
115111
find / -xdev -perm -4000 -exec chmod ug-s {} + && \\
116112
chmod 0775 /usr/share/elasticsearch && \\
117113
chown elasticsearch bin config config/jvm.options.d data logs plugins
118114

119-
120115
EXPOSE 9200 9300
121116

122117
LABEL org.label-schema.build-date="${build_date}" \\

docs/changelog/127962.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 127962
2+
summary: Support DATE_NANOS in LOOKUP JOIN
3+
area: ES|QL
4+
type: bug
5+
issues:
6+
- 127249

docs/changelog/128538.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 128538
2+
summary: "Added Mistral Chat Completion support to the Inference Plugin"
3+
area: Machine Learning
4+
type: enhancement
5+
issues: []

docs/changelog/128788.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 105773
2+
summary: Inject an unfollow action before executing a downsample action in ILM
3+
area: ILM+SLM
4+
type: bug
5+
issues:
6+
- 105773

docs/changelog/128858.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 128858
2+
summary: Fix unsupported privileges error message during role and API key crea…
3+
area: Authorization
4+
type: enhancement
5+
issues:
6+
- 128132

server/src/main/java/org/elasticsearch/common/text/Text.java renamed to libs/x-content/src/main/java/org/elasticsearch/xcontent/Text.java

Lines changed: 48 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,17 @@
66
* your election, the "Elastic License 2.0", the "GNU Affero General Public
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
9-
package org.elasticsearch.common.text;
10-
11-
import org.apache.lucene.util.BytesRef;
12-
import org.elasticsearch.common.bytes.BytesArray;
13-
import org.elasticsearch.common.bytes.BytesReference;
14-
import org.elasticsearch.xcontent.ToXContentFragment;
15-
import org.elasticsearch.xcontent.XContentBuilder;
9+
package org.elasticsearch.xcontent;
1610

1711
import java.io.IOException;
12+
import java.nio.ByteBuffer;
1813
import java.nio.charset.StandardCharsets;
1914

2015
/**
21-
* Both {@link String} and {@link BytesReference} representation of the text. Starts with one of those, and if
22-
* the other is requests, caches the other one in a local reference so no additional conversion will be needed.
16+
* Both {@link String} and {@link UTF8Bytes} representation of the text. Starts with one of those, and if
17+
* the other is requested, caches the other one in a local reference so no additional conversion will be needed.
2318
*/
24-
public final class Text implements Comparable<Text>, ToXContentFragment {
19+
public final class Text implements XContentString, Comparable<Text>, ToXContentFragment {
2520

2621
public static final Text[] EMPTY_ARRAY = new Text[0];
2722

@@ -36,31 +31,46 @@ public static Text[] convertFromStringArray(String[] strings) {
3631
return texts;
3732
}
3833

39-
private BytesReference bytes;
40-
private String text;
34+
private UTF8Bytes bytes;
35+
private String string;
4136
private int hash;
37+
private int stringLength = -1;
38+
39+
/**
40+
* Construct a Text from encoded UTF8Bytes. Since no string length is specified, {@link #stringLength()}
41+
* will perform a string conversion to measure the string length.
42+
*/
43+
public Text(UTF8Bytes bytes) {
44+
this.bytes = bytes;
45+
}
4246

43-
public Text(BytesReference bytes) {
47+
/**
48+
* Construct a Text from encoded UTF8Bytes and an explicit string length. Used to avoid string conversion
49+
* in {@link #stringLength()}. The provided stringLength should match the value that would
50+
* be calculated by {@link Text#Text(UTF8Bytes)}.
51+
*/
52+
public Text(UTF8Bytes bytes, int stringLength) {
4453
this.bytes = bytes;
54+
this.stringLength = stringLength;
4555
}
4656

47-
public Text(String text) {
48-
this.text = text;
57+
public Text(String string) {
58+
this.string = string;
4959
}
5060

5161
/**
52-
* Whether a {@link BytesReference} view of the data is already materialized.
62+
* Whether an {@link UTF8Bytes} view of the data is already materialized.
5363
*/
5464
public boolean hasBytes() {
5565
return bytes != null;
5666
}
5767

58-
/**
59-
* Returns a {@link BytesReference} view of the data.
60-
*/
61-
public BytesReference bytes() {
68+
@Override
69+
public UTF8Bytes bytes() {
6270
if (bytes == null) {
63-
bytes = new BytesArray(text.getBytes(StandardCharsets.UTF_8));
71+
var byteBuff = StandardCharsets.UTF_8.encode(string);
72+
assert byteBuff.hasArray();
73+
bytes = new UTF8Bytes(byteBuff.array(), byteBuff.arrayOffset() + byteBuff.position(), byteBuff.remaining());
6474
}
6575
return bytes;
6676
}
@@ -69,14 +79,25 @@ public BytesReference bytes() {
6979
* Whether a {@link String} view of the data is already materialized.
7080
*/
7181
public boolean hasString() {
72-
return text != null;
82+
return string != null;
7383
}
7484

75-
/**
76-
* Returns a {@link String} view of the data.
77-
*/
85+
@Override
7886
public String string() {
79-
return text == null ? bytes.utf8ToString() : text;
87+
if (string == null) {
88+
var byteBuff = ByteBuffer.wrap(bytes.bytes(), bytes.offset(), bytes.length());
89+
string = StandardCharsets.UTF_8.decode(byteBuff).toString();
90+
assert (stringLength < 0) || (string.length() == stringLength);
91+
}
92+
return string;
93+
}
94+
95+
@Override
96+
public int stringLength() {
97+
if (stringLength < 0) {
98+
stringLength = string().length();
99+
}
100+
return stringLength;
80101
}
81102

82103
@Override
@@ -115,8 +136,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
115136
} else {
116137
// TODO: TextBytesOptimization we can use a buffer here to convert it? maybe add a
117138
// request to jackson to support InputStream as well?
118-
BytesRef br = this.bytes().toBytesRef();
119-
return builder.utf8Value(br.bytes, br.offset, br.length);
139+
return builder.utf8Value(bytes.bytes(), bytes.offset(), bytes.length());
120140
}
121141
}
122142
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
package org.elasticsearch.xcontent;
11+
12+
import java.nio.ByteBuffer;
13+
14+
public interface XContentString {
15+
record UTF8Bytes(byte[] bytes, int offset, int length) implements Comparable<UTF8Bytes> {
16+
public UTF8Bytes(byte[] bytes) {
17+
this(bytes, 0, bytes.length);
18+
}
19+
20+
@Override
21+
public int compareTo(UTF8Bytes o) {
22+
if (this.bytes == o.bytes && this.offset == o.offset && this.length == o.length) {
23+
return 0;
24+
}
25+
26+
return ByteBuffer.wrap(bytes, offset, length).compareTo(ByteBuffer.wrap(o.bytes, o.offset, o.length));
27+
}
28+
29+
@Override
30+
public boolean equals(Object o) {
31+
if (this == o) {
32+
return true;
33+
}
34+
if (o == null || getClass() != o.getClass()) {
35+
return false;
36+
}
37+
38+
return this.compareTo((UTF8Bytes) o) == 0;
39+
}
40+
41+
@Override
42+
public int hashCode() {
43+
return ByteBuffer.wrap(bytes, offset, length).hashCode();
44+
}
45+
}
46+
47+
/**
48+
* Returns a {@link String} view of the data.
49+
*/
50+
String string();
51+
52+
/**
53+
* Returns an encoded {@link UTF8Bytes} view of the data.
54+
*/
55+
UTF8Bytes bytes();
56+
57+
/**
58+
* Returns the number of characters in the represented string.
59+
*/
60+
int stringLength();
61+
}

0 commit comments

Comments
 (0)