Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/gradle/plugins/repository-azure/c…
Browse files Browse the repository at this point in the history
…om.nimbusds-nimbus-jose-jwt-9.41.1

Signed-off-by: gaobinlong <gbinlong@amazon.com>
  • Loading branch information
gaobinlong authored Sep 24, 2024
2 parents c9091ab + eeb2f39 commit 18b4829
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/delete_backport_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
if: startsWith(github.event.pull_request.head.ref,'backport/')
steps:
- name: Delete merged branch
uses: actions/github-script@v5
uses: actions/github-script@v7
with:
script: |
github.rest.git.deleteRef({
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Bump `ch.qos.logback:logback-core` from 1.5.6 to 1.5.8 ([#15946](https://github.com/opensearch-project/OpenSearch/pull/15946))
- Update protobuf from 3.25.4 to 3.25.5 ([#16011](https://github.com/opensearch-project/OpenSearch/pull/16011))
- Bump `com.nimbusds:nimbus-jose-jwt` from 9.40 to 9.41.1 ([#16038](https://github.com/opensearch-project/OpenSearch/pull/16038))
- Bump `actions/github-script` from 5 to 7 ([#16039](https://github.com/opensearch-project/OpenSearch/pull/16039))

### Changed

Expand All @@ -35,6 +36,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Fix wildcard query containing escaped character ([#15737](https://github.com/opensearch-project/OpenSearch/pull/15737))
- Fix case-insensitive query on wildcard field ([#15882](https://github.com/opensearch-project/OpenSearch/pull/15882))
- Add validation for the search backpressure cancellation settings ([#15501](https://github.com/opensearch-project/OpenSearch/pull/15501))
- Fix search_as_you_type not supporting multi-fields ([#15988](https://github.com/opensearch-project/OpenSearch/pull/15988))
- Avoid infinite loop when `flat_object` field contains invalid token ([#15985](https://github.com/opensearch-project/OpenSearch/pull/15985))
- Fix infinite loop in nested agg ([#15931](https://github.com/opensearch-project/OpenSearch/pull/15931))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,15 @@ public SearchAsYouTypeFieldMapper build(Mapper.BuilderContext context) {
}
ft.setPrefixField(prefixFieldType);
ft.setShingleFields(shingleFieldTypes);
return new SearchAsYouTypeFieldMapper(name, ft, copyTo.build(), prefixFieldMapper, shingleFieldMappers, this);
return new SearchAsYouTypeFieldMapper(
name,
ft,
multiFieldsBuilder.build(this, context),
copyTo.build(),
prefixFieldMapper,
shingleFieldMappers,
this
);
}
}

Expand Down Expand Up @@ -623,12 +631,13 @@ public SpanQuery spanPrefixQuery(String value, SpanMultiTermQueryWrapper.SpanRew
public SearchAsYouTypeFieldMapper(
String simpleName,
SearchAsYouTypeFieldType mappedFieldType,
MultiFields multiFields,
CopyTo copyTo,
PrefixFieldMapper prefixField,
ShingleFieldMapper[] shingleFields,
Builder builder
) {
super(simpleName, mappedFieldType, MultiFields.empty(), copyTo);
super(simpleName, mappedFieldType, multiFields, copyTo);
this.prefixField = prefixField;
this.shingleFields = shingleFields;
this.maxShingleSize = builder.maxShingleSize.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,20 @@ private void assertMultiField(int shingleSize) throws IOException {
}
}

public void testSubField() throws IOException {
MapperService mapperService = createMapperService(
fieldMapping(
b -> b.field("type", "search_as_you_type")
.startObject("fields")
.startObject("subField")
.field("type", "keyword")
.endObject()
.endObject()
)
);
assertThat(mapperService.fieldType("field.subField"), instanceOf(KeywordFieldMapper.KeywordFieldType.class));
}

public void testIndexOptions() throws IOException {
DocumentMapper mapper = createDocumentMapper(
fieldMapping(b -> b.field("type", "search_as_you_type").field("index_options", "offsets"))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
setup:
- do:
indices.create:
index: test_1
body:
mappings:
properties:
text:
type: search_as_you_type
fields:
subField:
type: keyword
- do:
index:
index: test_1
id: 1
body: { text: test search as you type }

- do:
indices.refresh:
index: [test_1]

---
teardown:
- do:
indices.delete:
index: test_1

# related issue: https://github.com/opensearch-project/OpenSearch/issues/5035
---
"Test search_as_you_type data type supports multi-fields":
- skip:
version: " - 2.99.99"
reason: "the bug was fixed since 3.0.0"

- do:
indices.get_mapping: {
index: test_1
}

- match: {test_1.mappings.properties.text.type: search_as_you_type}
- match: {test_1.mappings.properties.text.fields.subField.type: keyword}

- do:
search:
index: test_1
body:
query:
multi_match:
query: "test search"
type: "bool_prefix"

- match: {hits.total.value: 1}

- do:
search:
index: test_1
body:
query:
multi_match:
query: "test search"
type: "bool_prefix"
fields: ["text.subField"]

- match: {hits.total.value: 1}

- do:
search:
index: test_1
body:
query:
term:
text.subField: "test search as you type"

- match: {hits.total.value: 1}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.opensearch.common.settings.Settings;
import org.opensearch.common.settings.SettingsException;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.repositories.blobstore.BlobStoreRepository;
import org.opensearch.test.InternalTestCluster;
import org.opensearch.test.OpenSearchIntegTestCase;

Expand Down Expand Up @@ -68,15 +69,17 @@ public void testNewIndexIsRemoteStoreBackedForRemoteStoreDirectionAndMixedMode()
assertRemoteStoreBackedIndex(indexName2);
}

@AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/15793")
public void testNewRestoredIndexIsRemoteStoreBackedForRemoteStoreDirectionAndMixedMode() throws Exception {
logger.info("Initialize cluster: gives non remote cluster manager");
initializeCluster(false);

logger.info("Add remote and non-remote nodes");
setClusterMode(MIXED.mode);
addRemote = false;
String nonRemoteNodeName = internalCluster().startNode();
Settings settings = Settings.builder()
.put(BlobStoreRepository.SNAPSHOT_SHARD_PATH_PREFIX_SETTING.getKey(), snapshotShardPathFixedPrefix ? "c" : "")
.build();
String nonRemoteNodeName = internalCluster().startNode(settings);
addRemote = true;
String remoteNodeName = internalCluster().startNode();
internalCluster().validateClusterFormed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ public abstract class OpenSearchIntegTestCase extends OpenSearchTestCase {

private static Boolean segmentsPathFixedPrefix;

private static Boolean snapshotShardPathFixedPrefix;
protected static Boolean snapshotShardPathFixedPrefix;

private Path remoteStoreRepositoryPath;

Expand Down Expand Up @@ -2904,7 +2904,7 @@ private static Settings buildRemoteStoreNodeAttributes(
settings.put(RemoteStoreSettings.CLUSTER_REMOTE_STORE_PINNED_TIMESTAMP_ENABLED.getKey(), randomBoolean());
settings.put(RemoteStoreSettings.CLUSTER_REMOTE_STORE_SEGMENTS_PATH_PREFIX.getKey(), translogPathFixedPrefix ? "a" : "");
settings.put(RemoteStoreSettings.CLUSTER_REMOTE_STORE_TRANSLOG_PATH_PREFIX.getKey(), segmentsPathFixedPrefix ? "b" : "");
settings.put(BlobStoreRepository.SNAPSHOT_SHARD_PATH_PREFIX_SETTING.getKey(), segmentsPathFixedPrefix ? "c" : "");
settings.put(BlobStoreRepository.SNAPSHOT_SHARD_PATH_PREFIX_SETTING.getKey(), snapshotShardPathFixedPrefix ? "c" : "");
return settings.build();
}

Expand Down

0 comments on commit 18b4829

Please sign in to comment.