Skip to content

Commit b0d70e8

Browse files
authored
Merge branch 'main' into index_micro_benchmarks_results
2 parents 5c2bc3a + d77351c commit b0d70e8

File tree

60 files changed

+1865
-199
lines changed

Some content is hidden

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

60 files changed

+1865
-199
lines changed

build-tools-internal/src/main/resources/forbidden/es-all-signatures.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,11 @@ org.apache.logging.log4j.message.ParameterizedMessage#<init>(java.lang.String, j
6161

6262
@defaultMessage Use WriteLoadForecaster#getForecastedWriteLoad instead
6363
org.elasticsearch.cluster.metadata.IndexMetadata#getForecastedWriteLoad()
64+
65+
# This is a temporary patch as there is a low level Lucene bug in certain scenarios
66+
# this should be fixed in the new Lucene release 10.3+
67+
org.apache.lucene.document.LongField#newExactQuery(java.lang.String, long) @ Use org.elasticsearch.lucene.document.NumericField#newExactLongQuery(java.lang.String, long) instead.
68+
org.apache.lucene.document.LongField#newRangeQuery(java.lang.String, long, long) @ Use org.elasticsearch.lucene.document.NumericField#newRangeLongQuery(java.lang.String, long, long) instead.
69+
org.apache.lucene.document.IntField#newExactQuery(java.lang.String, int) @ Use org.elasticsearch.lucene.document.NumericField#newExactIntQuery(java.lang.String, int) instead.
70+
org.apache.lucene.document.IntField#newRangeQuery(java.lang.String, int, int) @ Use org.elasticsearch.lucene.document.NumericField#newRangeIntQuery(java.lang.String, int, int) instead.
71+
org.apache.lucene.search.IndexSortSortedNumericDocValuesRangeQuery @ use org.elasticsearch.lucene.search.XIndexSortSortedNumericDocValuesRangeQuery instead.

build-tools-internal/src/test/java/org/elasticsearch/gradle/internal/release/ReleaseNotesGeneratorTest.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@
2020

2121
import static org.elasticsearch.gradle.internal.release.GenerateReleaseNotesTask.getSortedBundlesWithUniqueChangelogs;
2222
import static org.hamcrest.Matchers.equalTo;
23+
import static org.junit.Assert.assertFalse;
2324
import static org.junit.Assert.assertThat;
2425

2526
public class ReleaseNotesGeneratorTest {
2627

28+
// Temporarily set this to `true` to regenerate test output files when they need to be updated
29+
private final boolean UPDATE_EXPECTED_OUTPUT = false;
30+
2731
private static final List<String> CHANGE_TYPES = List.of(
2832
"breaking",
2933
"breaking-java",
@@ -78,8 +82,9 @@ public void testTemplate(String templateFilename, String outputFilename) throws
7882

7983
public void testTemplate(String templateFilename, String outputFilename, List<ChangelogBundle> bundles) throws Exception {
8084
// given:
85+
final String outputFile = "/org/elasticsearch/gradle/internal/release/ReleaseNotesGeneratorTest." + outputFilename;
8186
final String template = getResource("/templates/" + templateFilename);
82-
final String expectedOutput = getResource("/org/elasticsearch/gradle/internal/release/ReleaseNotesGeneratorTest." + outputFilename);
87+
final String expectedOutput = getResource(outputFile);
8388

8489
if (bundles == null) {
8590
bundles = getBundles();
@@ -91,7 +96,12 @@ public void testTemplate(String templateFilename, String outputFilename, List<Ch
9196
final String actualOutput = ReleaseNotesGenerator.generateFile(template, bundles);
9297

9398
// then:
94-
assertThat(actualOutput, equalTo(expectedOutput));
99+
if (UPDATE_EXPECTED_OUTPUT) {
100+
writeResource(outputFile, actualOutput);
101+
assertFalse("UPDATE_EXPECTED_OUTPUT should be set back to false after updating output", UPDATE_EXPECTED_OUTPUT);
102+
} else {
103+
assertThat(actualOutput, equalTo(expectedOutput));
104+
}
95105
}
96106

97107
private List<ChangelogBundle> getBundles() {
@@ -176,4 +186,9 @@ private ChangelogEntry makeHighlightsEntry(int pr, boolean notable) {
176186
private String getResource(String name) throws Exception {
177187
return Files.readString(Paths.get(Objects.requireNonNull(this.getClass().getResource(name)).toURI()), StandardCharsets.UTF_8);
178188
}
189+
190+
private void writeResource(String name, String contents) throws Exception {
191+
String path = "src/test/resources" + name;
192+
Files.writeString(Paths.get(path), contents);
193+
}
179194
}

build-tools-internal/src/test/resources/org/elasticsearch/gradle/internal/release/ReleaseNotesGeneratorTest.index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ To check for security updates, go to [Security announcements for the Elastic sta
2020
% ### Fixes [elasticsearch-next-fixes]
2121
% *
2222

23+
## 9.1.0 [elasticsearch-9.1.0-release-notes]
2324
```{applies_to}
2425
stack: coming 9.1.0
2526
```
26-
## 9.1.0 [elasticsearch-9.1.0-release-notes]
2727

2828
### Highlights [elasticsearch-9.1.0-highlights]
2929

@@ -47,10 +47,10 @@ Search:
4747
* [#52](https://github.com/elastic/elasticsearch/pull/52)
4848

4949

50+
## 9.0.10 [elasticsearch-9.0.10-release-notes]
5051
```{applies_to}
5152
stack: coming 9.0.10
5253
```
53-
## 9.0.10 [elasticsearch-9.0.10-release-notes]
5454

5555
### Features and enhancements [elasticsearch-9.0.10-features-enhancements]
5656

build-tools-internal/src/test/resources/org/elasticsearch/gradle/internal/release/ReleaseNotesGeneratorTest.index.no-highlights.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ To check for security updates, go to [Security announcements for the Elastic sta
2020
% ### Fixes [elasticsearch-next-fixes]
2121
% *
2222

23+
## 9.0.10 [elasticsearch-9.0.10-release-notes]
2324
```{applies_to}
2425
stack: coming 9.0.10
2526
```
26-
## 9.0.10 [elasticsearch-9.0.10-release-notes]
2727

2828
### Features and enhancements [elasticsearch-9.0.10-features-enhancements]
2929

docs/changelog/127968.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 127968
2+
summary: "Enable sort optimization on int, short and byte fields"
3+
area: Search
4+
type: enhancement
5+
issues:
6+
- 127965

docs/changelog/128036.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 128036
2+
summary: Fix inner hits + aggregations concurrency bug
3+
area: Search
4+
type: bug
5+
issues:
6+
- 122419

docs/changelog/128176.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 128176
2+
summary: Implement SAML custom attributes support for Identity Provider
3+
area: Authentication
4+
type: enhancement
5+
issues: []

docs/changelog/128740.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 128740
2+
summary: Optimize sparse vector stats collection
3+
area: Stats
4+
type: enhancement
5+
issues: []

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyManager.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,14 +376,21 @@ boolean isTriviallyAllowed(Class<?> requestingClass) {
376376
generalLogger.debug("Entitlement trivially allowed from outermost frame");
377377
return true;
378378
}
379-
if (SYSTEM_LAYER_MODULES.contains(requestingClass.getModule())) {
379+
if (isTrustedSystemClass(requestingClass)) {
380380
generalLogger.debug("Entitlement trivially allowed from system module [{}]", requestingClass.getModule().getName());
381381
return true;
382382
}
383383
generalLogger.trace("Entitlement not trivially allowed");
384384
return false;
385385
}
386386

387+
/**
388+
* The main decision point for what counts as a trusted built-in JDK class.
389+
*/
390+
protected boolean isTrustedSystemClass(Class<?> requestingClass) {
391+
return SYSTEM_LAYER_MODULES.contains(requestingClass.getModule());
392+
}
393+
387394
@Override
388395
public String toString() {
389396
return "PolicyManager{" + "serverEntitlements=" + serverEntitlements + ", pluginsEntitlements=" + pluginsEntitlements + '}';

modules/parent-join/src/internalClusterTest/java/org/elasticsearch/join/query/InnerHitsIT.java

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import org.elasticsearch.script.ScriptType;
2727
import org.elasticsearch.search.SearchHit;
2828
import org.elasticsearch.search.SearchHits;
29+
import org.elasticsearch.search.aggregations.AggregationBuilder;
30+
import org.elasticsearch.search.aggregations.metrics.TopHits;
2931
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
3032
import org.elasticsearch.search.fetch.subphase.highlight.HighlightField;
3133
import org.elasticsearch.search.sort.FieldSortBuilder;
@@ -51,6 +53,7 @@
5153
import static org.elasticsearch.index.seqno.SequenceNumbers.UNASSIGNED_SEQ_NO;
5254
import static org.elasticsearch.join.query.JoinQueryBuilders.hasChildQuery;
5355
import static org.elasticsearch.join.query.JoinQueryBuilders.hasParentQuery;
56+
import static org.elasticsearch.search.aggregations.AggregationBuilders.topHits;
5457
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
5558
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
5659
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCountAndNoFailures;
@@ -64,6 +67,7 @@
6467
import static org.hamcrest.Matchers.containsString;
6568
import static org.hamcrest.Matchers.equalTo;
6669
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
70+
import static org.hamcrest.Matchers.lessThanOrEqualTo;
6771
import static org.hamcrest.Matchers.notNullValue;
6872
import static org.hamcrest.Matchers.nullValue;
6973

@@ -698,4 +702,68 @@ public void testTooHighResultWindow() {
698702
)
699703
);
700704
}
705+
706+
public void testTopHitsOnParentChild() throws Exception {
707+
assertAcked(
708+
prepareCreate("idx").setMapping(
709+
jsonBuilder().startObject()
710+
.startObject("_doc")
711+
.startObject("properties")
712+
.startObject("id")
713+
.field("type", "keyword")
714+
.endObject()
715+
.startObject("join_field")
716+
.field("type", "join")
717+
.startObject("relations")
718+
.field("parent", new String[] { "child1", "child2" })
719+
.endObject()
720+
.endObject()
721+
.endObject()
722+
.endObject()
723+
.endObject()
724+
)
725+
);
726+
ensureGreen("idx");
727+
728+
List<IndexRequestBuilder> requestBuilders = new ArrayList<>();
729+
int numDocs = scaledRandomIntBetween(10, 100);
730+
int child1 = 0;
731+
int child2 = 0;
732+
int[] child1InnerObjects = new int[numDocs];
733+
int[] child2InnerObjects = new int[numDocs];
734+
for (int parent = 0; parent < numDocs; parent++) {
735+
String parentId = String.format(Locale.ENGLISH, "p_%03d", parent);
736+
requestBuilders.add(createIndexRequest("idx", "parent", parentId, null));
737+
738+
int numChildDocs = child1InnerObjects[parent] = scaledRandomIntBetween(1, numDocs);
739+
int limit = child1 + numChildDocs;
740+
for (; child1 < limit; child1++) {
741+
requestBuilders.add(createIndexRequest("idx", "child1", String.format(Locale.ENGLISH, "c1_%04d", child1), parentId));
742+
}
743+
numChildDocs = child2InnerObjects[parent] = scaledRandomIntBetween(1, numDocs);
744+
limit = child2 + numChildDocs;
745+
for (; child2 < limit; child2++) {
746+
requestBuilders.add(createIndexRequest("idx", "child2", String.format(Locale.ENGLISH, "c2_%04d", child2), parentId));
747+
}
748+
}
749+
750+
indexRandom(true, requestBuilders);
751+
ensureSearchable();
752+
753+
QueryBuilder hasChildQuery = hasChildQuery("child2", matchAllQuery(), ScoreMode.None).innerHit(new InnerHitBuilder().setSize(2));
754+
AggregationBuilder topHitsAgg = topHits("top-children").size(3);
755+
756+
assertNoFailuresAndResponse(prepareSearch("idx").setQuery(hasChildQuery).addAggregation(topHitsAgg), response -> {
757+
assertHitCount(response, numDocs);
758+
759+
TopHits topHits = response.getAggregations().get("top-children");
760+
SearchHits hits = topHits.getHits();
761+
assertThat(hits.getHits().length, equalTo(3));
762+
763+
for (SearchHit hit : hits) {
764+
SearchHits innerHits = hit.getInnerHits().get("child2");
765+
assertThat(innerHits.getHits().length, lessThanOrEqualTo(2));
766+
}
767+
});
768+
}
701769
}

0 commit comments

Comments
 (0)