Skip to content

Commit

Permalink
Uploaded Index generated from Lucene 8.x ( OpenSearch 1.3.0 ) to be u…
Browse files Browse the repository at this point in the history
…sed by UnitTests

Signed-off-by: expani <[email protected]>
  • Loading branch information
expani committed Dec 19, 2024
1 parent 17ecd4c commit 2ae505b
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
*/
public final class RemoteSnapshotDirectory extends Directory {

public static final Version SEARCHABLE_SNAPSHOT_EXTENDED_COMPATIBILITY_MINIMUM_VERSION = LegacyESVersion.V_6_0_0;
public static final Version SEARCHABLE_SNAPSHOT_EXTENDED_COMPATIBILITY_MINIMUM_VERSION = LegacyESVersion.V_7_2_0;

private static final String VIRTUAL_FILE_PREFIX = BlobStoreRepository.VIRTUAL_DATA_BLOB_PREFIX;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,11 @@ public void testNumDocs() throws IOException {

/**
* Tests whether old segments are readable and queryable based on the data documented
* in the README <a href="file:../../../../../resources/indices/bwc/es-6.3.0/README.md">here</a>.
* in the README <a href="file:../../../../../resources/indices/bwc/os-1.3.0/README.md">here</a>.
*/
public void testReadSegmentInfosExtendedCompatibility() throws IOException {
final String pathToTestIndex = "/indices/bwc/es-6.3.0/testIndex-es-6.3.0.zip";
final Version minVersion = LegacyESVersion.V_6_0_0;
final String pathToTestIndex = "/indices/bwc/os-1.3.0/testIndex-os-1.3.0.zip";
final Version minVersion = LegacyESVersion.V_7_2_0;
Path tmp = createTempDir();
TestUtil.unzip(getClass().getResourceAsStream(pathToTestIndex), tmp);
try (MockDirectoryWrapper dir = newMockFSDirectory(tmp)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public void testReadOldIndices() throws Exception {
IOUtils.close(engine, store);
// The index has one document in it, so the checkpoint cannot be NO_OPS_PERFORMED
final AtomicLong globalCheckpoint = new AtomicLong(0);
final String pathToTestIndex = "/indices/bwc/es-6.3.0/testIndex-es-6.3.0.zip";
final String pathToTestIndex = "/indices/bwc/os-1.3.0/testIndex-os-1.3.0.zip";
Path tmp = createTempDir();
TestUtil.unzip(getClass().getResourceAsStream(pathToTestIndex), tmp);
FeatureFlagSetter.set(FeatureFlags.SEARCHABLE_SNAPSHOT_EXTENDED_COMPATIBILITY);
Expand All @@ -266,7 +266,7 @@ public void testReadOldIndicesFailure() throws IOException {
IOUtils.close(engine, store);
// The index has one document in it, so the checkpoint cannot be NO_OPS_PERFORMED
final AtomicLong globalCheckpoint = new AtomicLong(0);
final String pathToTestIndex = "/indices/bwc/es-6.3.0/testIndex-es-6.3.0.zip";
final String pathToTestIndex = "/indices/bwc/os-1.3.0/testIndex-os-1.3.0.zip";
Path tmp = createTempDir();
TestUtil.unzip(getClass().getResourceAsStream(pathToTestIndex), tmp);
try (Store store = createStore(newFSDirectory(tmp))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ public void testSegmentReplicationDiff() {
@SuppressForbidden(reason = "sets the SEARCHABLE_SNAPSHOT_EXTENDED_COMPATIBILITY feature flag")
public void testReadSegmentsFromOldIndices() throws Exception {
int expectedIndexCreatedVersionMajor = SEARCHABLE_SNAPSHOT_EXTENDED_COMPATIBILITY_MINIMUM_VERSION.luceneVersion.major;
final String pathToTestIndex = "/indices/bwc/es-6.3.0/testIndex-es-6.3.0.zip";
final String pathToTestIndex = "/indices/bwc/os-1.3.0/testIndex-os-1.3.0.zip";
Path tmp = createTempDir();
TestUtil.unzip(getClass().getResourceAsStream(pathToTestIndex), tmp);
final ShardId shardId = new ShardId("index", "_na_", 1);
Expand All @@ -1309,7 +1309,7 @@ public void testReadSegmentsFromOldIndices() throws Exception {
}

public void testReadSegmentsFromOldIndicesFailure() throws IOException {
final String pathToTestIndex = "/indices/bwc/es-6.3.0/testIndex-es-6.3.0.zip";
final String pathToTestIndex = "/indices/bwc/os-1.3.0/testIndex-os-1.3.0.zip";
final ShardId shardId = new ShardId("index", "_na_", 1);
Path tmp = createTempDir();
TestUtil.unzip(getClass().getResourceAsStream(pathToTestIndex), tmp);
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# README for _testIndex-es-6.3.0.zip_
# README for _testIndex-os-1.3.0.zip_

This zip file holds a Lucene index created using ElasticSearch 6.3.0.
This zip file holds a Lucene index created using OpenSearch 1.3.0 downloaded from https://opensearch.org/versions/opensearch-1-3-0.html
It was created by running the underlying commands against a single-node cluster,
then compressing the contents of the underlying Lucene index directory i.e.
the files under `<elasticsearch-root>/data/nodes/0/indices/<index-uuid>/0/index`.
Expand All @@ -16,7 +16,6 @@ curl -X PUT -H 'Content-Type: application/json' 'localhost:9200/testindex?pretty
"number_of_replicas": 0
},
"mappings": {
"testData": {
"properties": {
"id": { "type": "keyword" },
"isTestData": { "type": "boolean" },
Expand All @@ -35,11 +34,10 @@ curl -X PUT -H 'Content-Type: application/json' 'localhost:9200/testindex?pretty
"testDate": { "type": "date" },
"testLocation": { "type": "geo_point"}
}
}
}
}'
curl -X POST "localhost:9200/testindex/testData/?pretty" -H 'Content-Type: application/json' -d'
curl -X POST "localhost:9200/testindex/_doc/1" -H 'Content-Type: application/json' -d'
{
"id": "testData1",
"isTestData": true,
Expand All @@ -54,4 +52,7 @@ curl -X POST "localhost:9200/testindex/testData/?pretty" -H 'Content-Type: appli
"testLocation": "48.553532,-113.022881"
}
'
curl -X POST "localhost:9200/testindex/_flush" -H 'Content-Type: application/json' -d'{}'
```
Flushing is essential to commit the changes to ensure tests don't fail complaining there are no docs in segment.
Binary file not shown.

0 comments on commit 2ae505b

Please sign in to comment.