diff --git a/benchmarks/src/main/java/org/elasticsearch/benchmark/index/LuceneChangesSnapshotBenchmark.java b/benchmarks/src/main/java/org/elasticsearch/benchmark/index/LuceneChangesSnapshotBenchmark.java index 211e9f223f2a8..070f4ecc06e39 100644 --- a/benchmarks/src/main/java/org/elasticsearch/benchmark/index/LuceneChangesSnapshotBenchmark.java +++ b/benchmarks/src/main/java/org/elasticsearch/benchmark/index/LuceneChangesSnapshotBenchmark.java @@ -22,6 +22,7 @@ import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.io.Streams; import org.elasticsearch.common.logging.LogConfigurator; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.core.IOUtils; import org.elasticsearch.index.IndexVersion; @@ -66,8 +67,8 @@ @OutputTimeUnit(TimeUnit.MILLISECONDS) @State(Scope.Thread) public class LuceneChangesSnapshotBenchmark { - @Param({ "synthetic", "stored" }) - String sourceMode; + @Param({ "default", "logsdb" }) + String indexMode; @Param({ "true", "false" }) boolean sequential; @@ -88,7 +89,8 @@ public class LuceneChangesSnapshotBenchmark { public void setup() throws IOException { this.path = Files.createTempDirectory("snapshot_changes"); - this.mapperService = MapperServiceFactory.create(readMappings(sourceMode)); + Settings settings = indexMode.equals("logsdb") ? Settings.builder().put("index.mode", "logsdb").build() : Settings.EMPTY; + this.mapperService = MapperServiceFactory.create(settings, readMappings()); IndexWriterConfig config = new IndexWriterConfig(); config.setCodec( new PerFieldMapperCodec(Zstd814StoredFieldsFormat.Mode.BEST_COMPRESSION, mapperService, BigArrays.NON_RECYCLING_INSTANCE) @@ -186,10 +188,8 @@ public long recover() throws IOException { return totalSize; } - private String readMappings(String mode) throws IOException { - return Streams.readFully(LuceneChangesSnapshotBenchmark.class.getResourceAsStream("lucene-changes-mappings.json")) - .utf8ToString() - .replace("$1", mode); + private String readMappings() throws IOException { + return Streams.readFully(LuceneChangesSnapshotBenchmark.class.getResourceAsStream("lucene-changes-mappings.json")).utf8ToString(); } private InputStream readSampleDocs() throws IOException { diff --git a/benchmarks/src/main/java/org/elasticsearch/benchmark/index/mapper/MapperServiceFactory.java b/benchmarks/src/main/java/org/elasticsearch/benchmark/index/mapper/MapperServiceFactory.java index d3f210f774782..524576018f376 100644 --- a/benchmarks/src/main/java/org/elasticsearch/benchmark/index/mapper/MapperServiceFactory.java +++ b/benchmarks/src/main/java/org/elasticsearch/benchmark/index/mapper/MapperServiceFactory.java @@ -43,9 +43,13 @@ import java.util.Map; public class MapperServiceFactory { - public static MapperService create(String mappings) { + return create(Settings.EMPTY, mappings); + } + + public static MapperService create(Settings userSettings, String mappings) { Settings settings = Settings.builder() + .put(userSettings) .put("index.number_of_replicas", 0) .put("index.number_of_shards", 1) .put(IndexMetadata.SETTING_VERSION_CREATED, IndexVersion.current()) diff --git a/benchmarks/src/main/resources/org/elasticsearch/benchmark/index/lucene-changes-mappings.json b/benchmarks/src/main/resources/org/elasticsearch/benchmark/index/lucene-changes-mappings.json index 97928dff318eb..217bc64761bd5 100644 --- a/benchmarks/src/main/resources/org/elasticsearch/benchmark/index/lucene-changes-mappings.json +++ b/benchmarks/src/main/resources/org/elasticsearch/benchmark/index/lucene-changes-mappings.json @@ -9,9 +9,6 @@ "_data_stream_timestamp": { "enabled": true }, - "_source": { - "mode": "$1" - }, "date_detection": false, "runtime": { "rally.doc_size": {