Skip to content

Commit 0a6476a

Browse files
Merge branch 'main' into false-allow-dynamic-templates
Signed-off-by: Bruce Hong <[email protected]>
2 parents b6de4ed + 5486c63 commit 0a6476a

File tree

103 files changed

+3567
-435
lines changed

Some content is hidden

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

103 files changed

+3567
-435
lines changed

CHANGELOG.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
## [Unreleased 3.x]
77
### Added
88
- Add support for Warm Indices Write Block on Flood Watermark breach ([#18375](https://github.com/opensearch-project/OpenSearch/pull/18375))
9+
- FS stats for warm nodes based on addressable space ([#18767](https://github.com/opensearch-project/OpenSearch/pull/18767))
910
- Add support for custom index name resolver from cluster plugin ([#18593](https://github.com/opensearch-project/OpenSearch/pull/18593))
1011
- Rename WorkloadGroupTestUtil to WorkloadManagementTestUtil ([#18709](https://github.com/opensearch-project/OpenSearch/pull/18709))
1112
- Disallow resize for Warm Index, add Parameterized ITs for close in remote store ([#18686](https://github.com/opensearch-project/OpenSearch/pull/18686))
1213
- Ability to run Code Coverage with Gradle and produce the jacoco reports locally ([#18509](https://github.com/opensearch-project/OpenSearch/issues/18509))
14+
- Extend BooleanQuery must_not rewrite to numeric must, term, and terms queries ([#18498](https://github.com/opensearch-project/OpenSearch/pull/18498))
1315
- [Workload Management] Update logging and Javadoc, rename QueryGroup to WorkloadGroup ([#18711](https://github.com/opensearch-project/OpenSearch/issues/18711))
1416
- Add NodeResourceUsageStats to ClusterInfo ([#18480](https://github.com/opensearch-project/OpenSearch/issues/18472))
1517
- Introduce SecureHttpTransportParameters experimental API (to complement SecureTransportParameters counterpart) ([#18572](https://github.com/opensearch-project/OpenSearch/issues/18572))
@@ -23,19 +25,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2325
- Add BooleanQuery rewrite moving constant-scoring must clauses to filter clauses ([#18510](https://github.com/opensearch-project/OpenSearch/issues/18510))
2426
- Add functionality for plugins to inject QueryCollectorContext during QueryPhase ([#18637](https://github.com/opensearch-project/OpenSearch/pull/18637))
2527
- Add support for non-timing info in profiler ([#18460](https://github.com/opensearch-project/OpenSearch/issues/18460))
28+
- [Rule-based auto tagging] Bug fix and improvements ([#18726](https://github.com/opensearch-project/OpenSearch/pull/18726))
2629
- Extend Approximation Framework to other numeric types ([#18530](https://github.com/opensearch-project/OpenSearch/issues/18530))
2730
- Add Semantic Version field type mapper and extensive unit tests([#18454](https://github.com/opensearch-project/OpenSearch/pull/18454))
2831
- Pass index settings to system ingest processor factories. ([#18708](https://github.com/opensearch-project/OpenSearch/pull/18708))
2932
- Include named queries from rescore contexts in matched_queries array ([#18697](https://github.com/opensearch-project/OpenSearch/pull/18697))
3033
- Add the configurable limit on rule cardinality ([#18663](https://github.com/opensearch-project/OpenSearch/pull/18663))
3134
- [Experimental] Start in "clusterless" mode if a clusterless ClusterPlugin is loaded ([#18479](https://github.com/opensearch-project/OpenSearch/pull/18479))
3235
- [Star-Tree] Add star-tree search related stats ([#18707](https://github.com/opensearch-project/OpenSearch/pull/18707))
33-
- The dynamic mapping parameter supports false_allow_templates ([#18825](https://github.com/opensearch-project/OpenSearch/pull/18825))
36+
- Add support for plugins to profile information ([#18656](https://github.com/opensearch-project/OpenSearch/pull/18656))
37+
- Add support for Combined Fields query ([#18724](https://github.com/opensearch-project/OpenSearch/pull/18724))
38+
- Add support for false_allow_templates schema option ([#18825](https://github.com/opensearch-project/OpenSearch/pull/18825))
3439

3540
### Changed
3641
- Update Subject interface to use CheckedRunnable ([#18570](https://github.com/opensearch-project/OpenSearch/issues/18570))
3742
- Update SecureAuxTransportSettingsProvider to distinguish between aux transport types ([#18616](https://github.com/opensearch-project/OpenSearch/pull/18616))
3843
- Make node duress values cacheable ([#18649](https://github.com/opensearch-project/OpenSearch/pull/18649))
44+
- Change default value of remote_data_ratio, which is used in Searchable Snapshots and Writeable Warm from 0 to 5 and min allowed value to 1 ([#18767](https://github.com/opensearch-project/OpenSearch/pull/18767))
3945
- Making multi rate limiters in repository dynamic [#18069](https://github.com/opensearch-project/OpenSearch/pull/18069)
4046

4147
### Dependencies
@@ -54,10 +60,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5460
- Bump `org.bouncycastle:bcpg-fips` from 2.0.10 to 2.0.11 ([#18668](https://github.com/opensearch-project/OpenSearch/pull/18668))
5561
- Bump `com.password4j:password4j` from 1.8.2 to 1.8.3 ([#18668](https://github.com/opensearch-project/OpenSearch/pull/18668))
5662
- Bump `com.azure:azure-core` from 1.55.3 to 1.55.5 ([#18691](https://github.com/opensearch-project/OpenSearch/pull/18691))
57-
- Bump `com.google.jimfs:jimfs` from 1.3.0 to 1.3.1 ([#18743](https://github.com/opensearch-project/OpenSearch/pull/18743)), [#18746](https://github.com/opensearch-project/OpenSearch/pull/18746))
63+
- Bump `com.squareup.okhttp3:okhttp` from 4.12.0 to 5.1.0 ([#18749](https://github.com/opensearch-project/OpenSearch/pull/18749))
64+
- Bump `com.google.jimfs:jimfs` from 1.3.0 to 1.3.1 ([#18743](https://github.com/opensearch-project/OpenSearch/pull/18743)), [#18746](https://github.com/opensearch-project/OpenSearch/pull/18746)), [#18748](https://github.com/opensearch-project/OpenSearch/pull/18748))
5865
- Bump `com.azure:azure-storage-common` from 12.29.0 to 12.29.1 ([#18742](https://github.com/opensearch-project/OpenSearch/pull/18742))
5966
- Bump `org.apache.commons:commons-lang3` from 3.17.0 to 3.18.0 ([#18745](https://github.com/opensearch-project/OpenSearch/pull/18745))
60-
- Bump `com.nimbusds:nimbus-jose-jwt` from 10.2 to 10.3.1 ([#18759](https://github.com/opensearch-project/OpenSearch/pull/18759))
67+
- Bump `com.nimbusds:nimbus-jose-jwt` from 10.2 to 10.4 ([#18759](https://github.com/opensearch-project/OpenSearch/pull/18759), [#18804](https://github.com/opensearch-project/OpenSearch/pull/18804))
68+
- Bump `commons-beanutils:commons-beanutils` from 1.9.4 to 1.11.0 ([#18401](https://github.com/opensearch-project/OpenSearch/issues/18401))
69+
- Bump `org.xerial.snappy:snappy-java` from 1.1.10.7 to 1.1.10.8 ([#18803](https://github.com/opensearch-project/OpenSearch/pull/18803))
6170

6271
### Deprecated
6372

@@ -73,8 +82,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
7382
- Fix the backward compatibility regression with COMPLEMENT for Regexp queries introduced in OpenSearch 3.0 ([#18640](https://github.com/opensearch-project/OpenSearch/pull/18640))
7483
- Fix Replication lag computation ([#18602](https://github.com/opensearch-project/OpenSearch/pull/18602))
7584
- Fix max_score is null when sorting on score firstly ([#18715](https://github.com/opensearch-project/OpenSearch/pull/18715))
85+
- Field-level ignore_malformed should override index-level setting ([#18706](https://github.com/opensearch-project/OpenSearch/pull/18706))
7686
- Fixed Staggered merge - load average replace with AverageTrackers, some Default thresholds modified ([#18666](https://github.com/opensearch-project/OpenSearch/pull/18666))
7787
- Use `new SecureRandom()` to avoid blocking ([18729](https://github.com/opensearch-project/OpenSearch/issues/18729))
88+
- Use ScoreDoc instead of FieldDoc when creating TopScoreDocCollectorManager to avoid unnecessary conversion ([#18802](https://github.com/opensearch-project/OpenSearch/pull/18802))
89+
- Fix leafSorter optimization for ReadOnlyEngine and NRTReplicationEngine ([#18639](https://github.com/opensearch-project/OpenSearch/pull/18639))
7890

7991
### Security
8092

README.md

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
<img src="https://opensearch.org/assets/img/opensearch-logo-themed.svg" height="64px">
22

3-
[![Chat](https://img.shields.io/badge/chat-on%20forums-blue)](https://forum.opensearch.org/c/opensearch/)
4-
[![Documentation](https://img.shields.io/badge/documentation-reference-blue)](https://opensearch.org/docs/latest/opensearch/index/)
3+
[![LFX Health Score](https://insights.production.lfx.dev/api/badge/health-score?project=opensearch-foundation)](https://insights.linuxfoundation.org/project/opensearch-foundation)
4+
[![LFX Active Contributors](https://insights.production.lfx.dev/api/badge/active-contributors?project=opensearch-foundation&repos=https://github.com/opensearch-project/OpenSearch)](https://insights.linuxfoundation.org/project/opensearch-foundation/repository/opensearch-project-opensearch)
55
[![Code Coverage](https://codecov.io/gh/opensearch-project/OpenSearch/branch/main/graph/badge.svg)](https://codecov.io/gh/opensearch-project/OpenSearch)
6-
[![Untriaged Issues](https://img.shields.io/github/issues/opensearch-project/OpenSearch/untriaged?labelColor=red)](https://github.com/opensearch-project/OpenSearch/issues?q=is%3Aissue+is%3Aopen+label%3A"untriaged")
7-
[![Security Vulnerabilities](https://img.shields.io/github/issues/opensearch-project/OpenSearch/security%20vulnerability?labelColor=red)](https://github.com/opensearch-project/OpenSearch/issues?q=is%3Aissue+is%3Aopen+label%3A"security%20vulnerability")
8-
[![Open Issues](https://img.shields.io/github/issues/opensearch-project/OpenSearch)](https://github.com/opensearch-project/OpenSearch/issues)
9-
[![Open Pull Requests](https://img.shields.io/github/issues-pr/opensearch-project/OpenSearch)](https://github.com/opensearch-project/OpenSearch/pulls)
10-
[![2.19.3 Open Issues](https://img.shields.io/github/issues/opensearch-project/OpenSearch/v2.19.3)](https://github.com/opensearch-project/OpenSearch/issues?q=is%3Aissue+is%3Aopen+label%3A"v2.19.3")
11-
[![2.18.1 Open Issues](https://img.shields.io/github/issues/opensearch-project/OpenSearch/v2.18.1)](https://github.com/opensearch-project/OpenSearch/issues?q=is%3Aissue+is%3Aopen+label%3A"v2.18.1")
12-
[![3.0.0 Open Issues](https://img.shields.io/github/issues/opensearch-project/OpenSearch/v3.0.0)](https://github.com/opensearch-project/OpenSearch/issues?q=is%3Aissue+is%3Aopen+label%3A"v3.0.0")
13-
[![GHA gradle check](https://github.com/opensearch-project/OpenSearch/actions/workflows/gradle-check.yml/badge.svg)](https://github.com/opensearch-project/OpenSearch/actions/workflows/gradle-check.yml)
14-
[![GHA validate pull request](https://github.com/opensearch-project/OpenSearch/actions/workflows/wrapper.yml/badge.svg)](https://github.com/opensearch-project/OpenSearch/actions/workflows/wrapper.yml)
15-
[![GHA precommit](https://github.com/opensearch-project/OpenSearch/actions/workflows/precommit.yml/badge.svg)](https://github.com/opensearch-project/OpenSearch/actions/workflows/precommit.yml)
16-
[![Jenkins gradle check job](https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fbuild.ci.opensearch.org%2Fjob%2Fgradle-check%2F&label=Jenkins%20Gradle%20Check)](https://build.ci.opensearch.org/job/gradle-check/)
6+
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/opensearch-project/OpenSearch?sort=semver)
7+
8+
179

1810
- [Welcome!](#welcome)
1911
- [Project Resources](#project-resources)
@@ -30,10 +22,9 @@
3022
## Project Resources
3123

3224
* [Project Website](https://opensearch.org/)
33-
* [Downloads](https://opensearch.org/downloads.html)
34-
* [Documentation](https://opensearch.org/docs/)
35-
* Need help? Try [Forums](https://discuss.opendistrocommunity.dev/)
36-
* [Project Principles](https://opensearch.org/#principles)
25+
* [Downloads](https://opensearch.org/downloads/)
26+
* [Documentation](https://docs.opensearch.org/)
27+
* Need help? Try [Forums](https://discuss.opendistrocommunity.dev/) or [Slack](https://opensearch.org/slack/)
3728
* [Contributing to OpenSearch](CONTRIBUTING.md)
3829
* [Maintainer Responsibilities](MAINTAINERS.md)
3930
* [Release Management](RELEASING.md)

distribution/tools/keystore-cli/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ dependencies {
3434
compileOnly project(":server")
3535
compileOnly project(":libs:opensearch-cli")
3636
testImplementation project(":test:framework")
37-
testImplementation 'com.google.jimfs:jimfs:1.3.0'
37+
testImplementation 'com.google.jimfs:jimfs:1.3.1'
3838
testRuntimeOnly("com.google.guava:guava:${versions.guava}") {
3939
transitive = false
4040
}

modules/autotagging-commons/common/src/main/java/org/opensearch/rule/action/CreateRuleRequest.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,7 @@ public CreateRuleRequest(StreamInput in) throws IOException {
4949

5050
@Override
5151
public ActionRequestValidationException validate() {
52-
try {
53-
rule.getFeatureType().getFeatureValueValidator().validate(rule.getFeatureValue());
54-
return null;
55-
} catch (Exception e) {
56-
ActionRequestValidationException validationException = new ActionRequestValidationException();
57-
validationException.addValidationError("Validation failed: " + e.getMessage());
58-
return validationException;
59-
}
52+
return null;
6053
}
6154

6255
@Override

modules/autotagging-commons/common/src/main/java/org/opensearch/rule/autotagging/RuleValidator.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ private List<String> validateFeatureType() {
114114
if (featureType == null) {
115115
return List.of("Couldn't identify which feature the rule belongs to. Rule feature can't be null.");
116116
}
117+
try {
118+
featureType.getFeatureValueValidator().validate(featureValue);
119+
} catch (Exception e) {
120+
return List.of(e.getMessage());
121+
}
117122
return new ArrayList<>();
118123
}
119124

modules/autotagging-commons/common/src/main/java/org/opensearch/rule/service/IndexStoredRulePersistenceService.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.opensearch.action.index.IndexRequest;
1717
import org.opensearch.action.search.SearchRequestBuilder;
1818
import org.opensearch.action.search.SearchResponse;
19+
import org.opensearch.action.support.WriteRequest;
1920
import org.opensearch.action.support.clustermanager.AcknowledgedResponse;
2021
import org.opensearch.action.update.UpdateRequest;
2122
import org.opensearch.cluster.service.ClusterService;
@@ -183,6 +184,7 @@ public void onFailure(Exception e) {
183184
private void persistRule(Rule rule, ActionListener<CreateRuleResponse> listener) {
184185
try {
185186
IndexRequest indexRequest = new IndexRequest(indexName).id(rule.getId())
187+
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
186188
.source(rule.toXContent(XContentFactory.jsonBuilder(), ToXContent.EMPTY_PARAMS));
187189
client.index(indexRequest).get();
188190
listener.onResponse(new CreateRuleResponse(rule));
@@ -312,9 +314,8 @@ public void onFailure(Exception e) {
312314
*/
313315
private void persistUpdatedRule(String ruleId, Rule updatedRule, ActionListener<UpdateRuleResponse> listener) {
314316
try {
315-
UpdateRequest updateRequest = new UpdateRequest(indexName, ruleId).doc(
316-
updatedRule.toXContent(XContentFactory.jsonBuilder(), ToXContent.EMPTY_PARAMS)
317-
);
317+
UpdateRequest updateRequest = new UpdateRequest(indexName, ruleId).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
318+
.doc(updatedRule.toXContent(XContentFactory.jsonBuilder(), ToXContent.EMPTY_PARAMS));
318319
client.update(updateRequest).get();
319320
listener.onResponse(new UpdateRuleResponse(updatedRule));
320321
} catch (Exception e) {

modules/autotagging-commons/common/src/test/java/org/opensearch/rule/autotagging/RuleValidatorTests.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
import static org.opensearch.rule.autotagging.RuleTests.TestAttribute.TEST_ATTRIBUTE_1;
2424
import static org.opensearch.rule.autotagging.RuleTests.UPDATED_AT;
2525
import static org.opensearch.rule.autotagging.RuleTests._ID;
26+
import static org.mockito.Mockito.doThrow;
27+
import static org.mockito.Mockito.mock;
28+
import static org.mockito.Mockito.when;
2629

2730
public class RuleValidatorTests extends OpenSearchTestCase {
2831

@@ -118,4 +121,14 @@ public void testEqualRuleValidators() {
118121
RuleValidator otherValidator = new RuleValidator(_ID, DESCRIPTION, ATTRIBUTE_MAP, FEATURE_VALUE, UPDATED_AT, FEATURE_TYPE);
119122
assertEquals(validator, otherValidator);
120123
}
124+
125+
public void testFeatureValueValidationThrows() {
126+
FeatureType mockFeatureType = mock(FeatureType.class);
127+
FeatureValueValidator mockValidator = mock(FeatureValueValidator.class);
128+
when(mockFeatureType.getFeatureValueValidator()).thenReturn(mockValidator);
129+
doThrow(new IllegalArgumentException("Invalid feature value")).when(mockValidator).validate("bad-value");
130+
RuleValidator validator = new RuleValidator(_ID, DESCRIPTION, ATTRIBUTE_MAP, "bad-value", UPDATED_AT, mockFeatureType);
131+
IllegalArgumentException ex = assertThrows(IllegalArgumentException.class, validator::validate);
132+
assertTrue(ex.getMessage().contains("Invalid feature value"));
133+
}
121134
}

modules/autotagging-commons/src/main/java/org/opensearch/rule/rest/RestGetRuleAction.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli
7474
}
7575

7676
final FeatureType featureType = FeatureType.from(request.param(FEATURE_TYPE));
77-
final Set<String> excludedKeys = Set.of(FEATURE_TYPE, ID_STRING, SEARCH_AFTER_STRING, "pretty");
78-
final List<String> requestParams = request.params().keySet().stream().filter(key -> !excludedKeys.contains(key)).toList();
79-
80-
for (String attributeName : requestParams) {
77+
final List<String> attributeParams = request.params()
78+
.keySet()
79+
.stream()
80+
.filter(key -> featureType.getAllowedAttributesRegistry().containsKey(key))
81+
.toList();
82+
for (String attributeName : attributeParams) {
8183
Attribute attribute = featureType.getAttributeFromName(attributeName);
8284
if (attribute == null) {
8385
throw new IllegalArgumentException(attributeName + " is not a valid attribute under feature type " + featureType.getName());

modules/autotagging-commons/src/test/java/org/opensearch/rule/rest/RestGetRuleActionTests.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,26 @@
88

99
package org.opensearch.rule.rest;
1010

11+
import org.opensearch.rest.RestRequest;
12+
import org.opensearch.rest.RestRequest.Method;
13+
import org.opensearch.rule.InMemoryRuleProcessingServiceTests;
14+
import org.opensearch.rule.autotagging.FeatureType;
1115
import org.opensearch.test.OpenSearchTestCase;
16+
import org.opensearch.test.rest.FakeRestRequest;
17+
import org.junit.Before;
18+
19+
import java.util.Map;
20+
21+
import static org.opensearch.rule.rest.RestGetRuleAction.FEATURE_TYPE;
1222

1323
public class RestGetRuleActionTests extends OpenSearchTestCase {
14-
RestGetRuleAction action = new RestGetRuleAction();;
24+
25+
private RestGetRuleAction action;
26+
27+
@Before
28+
public void setUpAction() {
29+
action = new RestGetRuleAction();
30+
}
1531

1632
public void testGetName() {
1733
assertEquals("get_rule", action.getName());
@@ -23,4 +39,12 @@ public void testRoutes() {
2339
assertTrue(routes.stream().anyMatch(r -> r.getPath().equals("_rules/{featureType}/")));
2440
assertTrue(routes.stream().anyMatch(r -> r.getPath().equals("_rules/{featureType}/{id}")));
2541
}
42+
43+
public void testPrepareRequestFiltersAllowedAttributes() {
44+
FeatureType featureType = InMemoryRuleProcessingServiceTests.WLMFeatureType.WLM;
45+
String validAttrName = featureType.getAllowedAttributesRegistry().keySet().iterator().next();
46+
Map<String, String> params = Map.of(FEATURE_TYPE, featureType.getName(), validAttrName, "value1", "invalidAttr", "shouldBeIgnored");
47+
RestRequest request = new FakeRestRequest.Builder(xContentRegistry()).withMethod(Method.GET).withParams(params).build();
48+
assertNotNull(action.prepareRequest(request, null));
49+
}
2650
}

modules/mapper-extras/src/main/java/org/opensearch/index/mapper/ScaledFloatFieldMapper.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,9 @@ boolean coerce() {
395395
return coerce.value();
396396
}
397397

398-
boolean ignoreMalformed() {
399-
return ignoreMalformed.value();
398+
@Override
399+
protected Explicit<Boolean> ignoreMalformed() {
400+
return ignoreMalformed;
400401
}
401402

402403
@Override

0 commit comments

Comments
 (0)