Skip to content

Commit f588845

Browse files
author
Gagan Singh Saini
committed
Merge branch 'main' into AddWarmDiskMonitor
2 parents 6e7922c + ec5adda commit f588845

File tree

45 files changed

+1249
-192
lines changed

Some content is hidden

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

45 files changed

+1249
-192
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1414
- Bump OpenSearch Core main branch to 3.0.0 ([#18039](https://github.com/opensearch-project/OpenSearch/pull/18039))
1515
- [Rule based Auto-tagging] Add wlm `ActionFilter` ([#17791](https://github.com/opensearch-project/OpenSearch/pull/17791))
1616
- [Rule based auto-tagging] Add update rule API ([#17797](https://github.com/opensearch-project/OpenSearch/pull/17797))
17+
- [Rule based auto-tagging] Bug fix for update rule api ([#18488](https://github.com/opensearch-project/OpenSearch/pull/18488))
1718
- Update API of Message in index to add the timestamp for lag calculation in ingestion polling ([#17977](https://github.com/opensearch-project/OpenSearch/pull/17977/))
1819
- Add Warm Disk Threshold Allocation Decider for Warm shards ([#18082](https://github.com/opensearch-project/OpenSearch/pull/18082))
1920
- Add support for Warm Indices Write Block on Flood Watermark breach ([#18375](https://github.com/opensearch-project/OpenSearch/pull/18375))
@@ -50,6 +51,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5051
- Added node-left metric to cluster manager ([#18421](https://github.com/opensearch-project/OpenSearch/pull/18421))
5152
- [Star tree] Remove star tree feature flag and add index setting to configure star tree search on index basis ([#18070](https://github.com/opensearch-project/OpenSearch/pull/18070))
5253
- Approximation Framework Enhancement: Update the BKD traversal logic to improve the performance on skewed data ([#18439](https://github.com/opensearch-project/OpenSearch/issues/18439))
54+
- Support system generated ingest pipelines for bulk update operations ([#18277](https://github.com/opensearch-project/OpenSearch/pull/18277)))
5355
- Added FS Health Check Failure metric ([#18435](https://github.com/opensearch-project/OpenSearch/pull/18435))
5456

5557
### Changed
@@ -100,7 +102,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
100102
- DocValues-only IP field supports `terms_query` with more than 1025 IP masks ([#18357](https://github.com/opensearch-project/OpenSearch/pull/18357)
101103
- Fix MatrixStatsAggregator reuse when mode parameter changes ([#18242](https://github.com/opensearch-project/OpenSearch/issues/18242))
102104
- Replace the deprecated construction method of TopScoreDocCollectorManager with the new method ([#18395](https://github.com/opensearch-project/OpenSearch/pull/18395))
103-
- Fixed Approximate Framework regression with Lucene 10.2.1 by updating `intersectRight` BKD walk and `IntRef` visit method ([#18358](https://github.com/opensearch-project/OpenSearch/issues/18358
105+
- Fixed Approximate Framework regression with Lucene 10.2.1 by updating `intersectRight` BKD walk and `IntRef` visit method ([#18358](https://github.com/opensearch-project/OpenSearch/issues/18358))
106+
- Add task cancellation checks in aggregators ([#18426](https://github.com/opensearch-project/OpenSearch/pull/18426))
104107

105108
### Security
106109

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,12 @@ public static String computeRuleHash(
6767
public static Optional<String> getDuplicateRuleId(Rule rule, List<Rule> ruleList) {
6868
Map<Attribute, Set<String>> targetAttributeMap = rule.getAttributeMap();
6969
for (Rule currRule : ruleList) {
70-
Map<Attribute, Set<String>> existingAttributeMap = currRule.getAttributeMap();
70+
String currRuleId = currRule.getId();
71+
if (currRuleId.equals(rule.getId())) {
72+
continue;
73+
}
7174

75+
Map<Attribute, Set<String>> existingAttributeMap = currRule.getAttributeMap();
7276
if (rule.getFeatureType() != currRule.getFeatureType() || targetAttributeMap.size() != existingAttributeMap.size()) {
7377
continue;
7478
}
@@ -82,7 +86,7 @@ public static Optional<String> getDuplicateRuleId(Rule rule, List<Rule> ruleList
8286
}
8387
}
8488
if (allAttributesIntersect) {
85-
return Optional.of(currRule.getId());
89+
return Optional.of(currRuleId);
8690
}
8791
}
8892
return Optional.empty();

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

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.util.Optional;
2020
import java.util.Set;
2121

22+
import static org.opensearch.rule.utils.RuleTestUtils.ATTRIBUTE_MAP;
2223
import static org.opensearch.rule.utils.RuleTestUtils.ATTRIBUTE_VALUE_ONE;
2324
import static org.opensearch.rule.utils.RuleTestUtils.ATTRIBUTE_VALUE_TWO;
2425
import static org.opensearch.rule.utils.RuleTestUtils.DESCRIPTION_ONE;
@@ -28,15 +29,25 @@
2829
import static org.opensearch.rule.utils.RuleTestUtils.MockRuleAttributes;
2930
import static org.opensearch.rule.utils.RuleTestUtils.TIMESTAMP_ONE;
3031
import static org.opensearch.rule.utils.RuleTestUtils._ID_ONE;
32+
import static org.opensearch.rule.utils.RuleTestUtils._ID_TWO;
3133
import static org.opensearch.rule.utils.RuleTestUtils.ruleOne;
3234
import static org.opensearch.rule.utils.RuleTestUtils.ruleTwo;
3335

3436
public class RuleUtilsTests extends OpenSearchTestCase {
3537

3638
public void testDuplicateRuleFound() {
37-
Optional<String> result = RuleUtils.getDuplicateRuleId(ruleOne, List.of(ruleOne, ruleTwo));
39+
Rule testRule = Rule.builder()
40+
.id(_ID_TWO)
41+
.description(DESCRIPTION_ONE)
42+
.featureType(RuleTestUtils.MockRuleFeatureType.INSTANCE)
43+
.featureValue(FEATURE_VALUE_ONE)
44+
.attributeMap(ATTRIBUTE_MAP)
45+
.updatedAt(TIMESTAMP_ONE)
46+
.build();
47+
48+
Optional<String> result = RuleUtils.getDuplicateRuleId(ruleOne, List.of(testRule));
3849
assertTrue(result.isPresent());
39-
assertEquals(_ID_ONE, result.get());
50+
assertEquals(_ID_TWO, result.get());
4051
}
4152

4253
public void testNoAttributeIntersection() {
@@ -66,7 +77,7 @@ public void testAttributeSizeMismatch() {
6677

6778
public void testPartialAttributeValueIntersection() {
6879
Rule ruleWithPartialOverlap = Rule.builder()
69-
.id(_ID_ONE)
80+
.id(_ID_TWO)
7081
.description(DESCRIPTION_ONE)
7182
.featureType(RuleTestUtils.MockRuleFeatureType.INSTANCE)
7283
.featureValue(FEATURE_VALUE_ONE)
@@ -79,6 +90,11 @@ public void testPartialAttributeValueIntersection() {
7990
assertEquals(_ID_ONE, result.get());
8091
}
8192

93+
public void testDuplicateRuleWithSameId() {
94+
Optional<String> result = RuleUtils.getDuplicateRuleId(ruleOne, List.of(ruleOne));
95+
assertFalse(result.isPresent());
96+
}
97+
8298
public void testDifferentFeatureTypes() {
8399
Rule differentFeatureTypeRule = Rule.builder()
84100
.id(_ID_ONE)

plugins/examples/mapping-transformer/src/yamlRestTest/resources/rest-api-spec/test/example-mapping-transformer/20_mapping_transformer.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@
3939

4040
---
4141
"Test auto-injected field via index template":
42+
- skip:
43+
features: allowed_warnings
4244
- do:
45+
allowed_warnings:
46+
- "index template [example_template] has index patterns [auto-template-*] matching patterns from existing older templates [global] with patterns (global => [*]); this template [example_template] will take precedence during new index creation"
4347
indices.put_index_template:
4448
name: example_template
4549
body:
@@ -62,6 +66,8 @@
6266

6367
---
6468
"Test auto-injected field via legacy create template API":
69+
- skip:
70+
features: allowed_warnings
6571
- do:
6672
indices.put_template:
6773
name: legacy_template
@@ -72,6 +78,8 @@
7278
mapping_transform_trigger_field:
7379
type: keyword
7480
- do:
81+
allowed_warnings:
82+
- "index [legacy-1] matches multiple legacy templates [global, legacy_template], composable templates will only match a single template"
7583
indices.create:
7684
index: legacy-1
7785
- do:

plugins/examples/system-ingest-processor/src/test/java/org/opensearch/example/systemingestprocessor/ExampleSystemIngestProcessorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void testSubBatchExecute() {
4444

4545
private IngestDocumentWrapper createIngestDocumentWrapper(int slot) {
4646
final IngestDocument ingestDocument = new IngestDocument(new HashMap<>(), new HashMap<>());
47-
return new IngestDocumentWrapper(slot, ingestDocument, null);
47+
return new IngestDocumentWrapper(slot, 0, ingestDocument, null);
4848
}
4949

5050
public void testGetType() {

plugins/examples/system-ingest-processor/src/yamlRestTest/resources/rest-api-spec/test/example-system-ingest-processor/20_system_ingest_processor.yml

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
teardown:
2+
- do:
3+
cluster.put_settings:
4+
body:
5+
persistent:
6+
cluster.ingest.system_pipeline_enabled: "true"
7+
18
---
29
"Processor injects a field on indexing a doc to existing index":
310
- do:
@@ -46,6 +53,8 @@
4653
- is_false: _source.field_auto_added_by_system_ingest_processor
4754
---
4855
"Processor injects field when index is created from matching template":
56+
- skip:
57+
features: allowed_warnings
4958
- do:
5059
indices.put_template:
5160
name: example-template
@@ -56,6 +65,8 @@
5665
system_ingest_processor_trigger_field:
5766
type: keyword
5867
- do:
68+
allowed_warnings:
69+
- "index [template-index-1] matches multiple legacy templates [example-template, global], composable templates will only match a single template"
5970
index:
6071
index: template-index-1
6172
id: 1
@@ -106,6 +117,8 @@
106117

107118
---
108119
"Processor injects field on bulk index to non-existent index matching template":
120+
- skip:
121+
features: allowed_warnings
109122
- do:
110123
indices.put_template:
111124
name: bulk-template
@@ -116,6 +129,8 @@
116129
system_ingest_processor_trigger_field:
117130
type: keyword
118131
- do:
132+
allowed_warnings:
133+
- "index [bulk-template-index-1] matches multiple legacy templates [bulk-template, global], composable templates will only match a single template"
119134
bulk:
120135
refresh: true
121136
body:
@@ -141,3 +156,135 @@
141156
id: 2
142157
- match:
143158
_source.field_auto_added_by_system_ingest_processor: "This field is auto added by the example system ingest processor."
159+
160+
---
161+
"Processor injects field on bulk update, upsert on existing/new documents":
162+
# Temporarily disable system ingest pipelines to insert without triggering the system ingest field
163+
- do:
164+
cluster.put_settings:
165+
body:
166+
persistent:
167+
cluster.ingest.system_pipeline_enabled: "false"
168+
169+
- do:
170+
indices.create:
171+
index: bulk-index
172+
body:
173+
mappings:
174+
properties:
175+
system_ingest_processor_trigger_field:
176+
type: keyword
177+
178+
# Index documents to be updated on later step
179+
- do:
180+
bulk:
181+
refresh: true
182+
body:
183+
- index:
184+
_index: bulk-index
185+
_id: "1"
186+
- system_ingest_processor_trigger_field: "bulk1"
187+
- index:
188+
_index: bulk-index
189+
_id: "2"
190+
- system_ingest_processor_trigger_field: "bulk2"
191+
- index:
192+
_index: bulk-index
193+
_id: "3"
194+
- system_ingest_processor_trigger_field: "bulk3"
195+
196+
# Verify system ingest pipelines weren't triggered on regular index operations
197+
- do:
198+
get:
199+
index: bulk-index
200+
id: 1
201+
- match:
202+
_source.field_auto_added_by_system_ingest_processor: null
203+
204+
- do:
205+
get:
206+
index: bulk-index
207+
id: 2
208+
- match:
209+
_source.field_auto_added_by_system_ingest_processor: null
210+
211+
- do:
212+
get:
213+
index: bulk-index
214+
id: 2
215+
- match:
216+
_source.field_auto_added_by_system_ingest_processor: null
217+
218+
# Reenable system ingest pipeline
219+
- do:
220+
cluster.put_settings:
221+
body:
222+
persistent:
223+
cluster.ingest.system_pipeline_enabled: "true"
224+
225+
# Bulk update, bulk upsert existing, and bulk upsert new should all trigger ingest pipelines
226+
- do:
227+
bulk:
228+
refresh: true
229+
body:
230+
- update:
231+
_index: bulk-index
232+
_id: "1"
233+
- doc:
234+
system_ingest_processor_trigger_field: "update bulk1"
235+
- update:
236+
_index: bulk-index
237+
_id: "2"
238+
- doc:
239+
system_ingest_processor_trigger_field: "update bulk2"
240+
upsert:
241+
system_ingest_processor_trigger_field: "new upsert bulk2"
242+
- update:
243+
_index: bulk-index
244+
_id: "3"
245+
- doc:
246+
system_ingest_processor_trigger_field: "doc as upsert bulk3"
247+
doc_as_upsert: true
248+
- update:
249+
_index: bulk-index
250+
_id: "4"
251+
- doc:
252+
system_ingest_processor_trigger_field: "update bulk4"
253+
upsert:
254+
system_ingest_processor_trigger_field: "new upsert bulk4"
255+
256+
- do:
257+
get:
258+
index: bulk-index
259+
id: 1
260+
- match:
261+
_source.field_auto_added_by_system_ingest_processor: "This field is auto added by the example system ingest processor."
262+
- match:
263+
_source.system_ingest_processor_trigger_field: "update bulk1"
264+
265+
- do:
266+
get:
267+
index: bulk-index
268+
id: 2
269+
- match:
270+
_source.field_auto_added_by_system_ingest_processor: "This field is auto added by the example system ingest processor."
271+
- match:
272+
_source.system_ingest_processor_trigger_field: "update bulk2"
273+
274+
- do:
275+
get:
276+
index: bulk-index
277+
id: 3
278+
- match:
279+
_source.field_auto_added_by_system_ingest_processor: "This field is auto added by the example system ingest processor."
280+
- match:
281+
_source.system_ingest_processor_trigger_field: "doc as upsert bulk3"
282+
283+
- do:
284+
get:
285+
index: bulk-index
286+
id: 4
287+
- match:
288+
_source.field_auto_added_by_system_ingest_processor: "This field is auto added by the example system ingest processor."
289+
- match:
290+
_source.system_ingest_processor_trigger_field: "new upsert bulk4"

0 commit comments

Comments
 (0)