Skip to content

Commit 4c00c44

Browse files
dreamer-89github-actions[bot]
authored andcommitted
[Type removal] Remove _type support in NOOP bulk indexing from client benchmark (#3076)
* [Type removal] Remove _type support in bulk indexing from client benchmark Signed-off-by: Suraj Singh <[email protected]> * Update README Signed-off-by: Suraj Singh <[email protected]> (cherry picked from commit c5ff8d6)
1 parent 15d129a commit 4c00c44

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

client/benchmark/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Example invocation:
2929
wget http://benchmarks.elasticsearch.org.s3.amazonaws.com/corpora/geonames/documents-2.json.bz2
3030
bzip2 -d documents-2.json.bz2
3131
mv documents-2.json client/benchmark/build
32-
gradlew -p client/benchmark run --args ' rest bulk localhost build/documents-2.json geonames type 8647880 5000'
32+
gradlew -p client/benchmark run --args ' rest bulk localhost build/documents-2.json geonames 8647880 5000'
3333
```
3434

3535
The parameters are all in the `'`s and are in order:
@@ -39,7 +39,6 @@ The parameters are all in the `'`s and are in order:
3939
* Benchmark target host IP (the host where OpenSearch is running)
4040
* full path to the file that should be bulk indexed
4141
* name of the index
42-
* name of the (sole) type in the index
4342
* number of documents in the file
4443
* bulk size
4544

client/benchmark/src/main/java/org/opensearch/client/benchmark/AbstractBenchmark.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public abstract class AbstractBenchmark<T extends Closeable> {
4949

5050
protected abstract T client(String benchmarkTargetHost) throws Exception;
5151

52-
protected abstract BulkRequestExecutor bulkRequestExecutor(T client, String indexName, String typeName);
52+
protected abstract BulkRequestExecutor bulkRequestExecutor(T client, String indexName);
5353

5454
protected abstract SearchRequestExecutor searchRequestExecutor(T client, String indexName);
5555

@@ -76,16 +76,15 @@ public final void run(String[] args) throws Exception {
7676

7777
@SuppressForbidden(reason = "system out is ok for a command line tool")
7878
private void runBulkIndexBenchmark(String[] args) throws Exception {
79-
if (args.length != 7) {
80-
System.err.println("usage: 'bulk' benchmarkTargetHostIp indexFilePath indexName typeName numberOfDocuments bulkSize");
79+
if (args.length != 6) {
80+
System.err.println("usage: 'bulk' benchmarkTargetHostIp indexFilePath indexName numberOfDocuments bulkSize");
8181
System.exit(1);
8282
}
8383
String benchmarkTargetHost = args[1];
8484
String indexFilePath = args[2];
8585
String indexName = args[3];
86-
String typeName = args[4];
87-
int totalDocs = Integer.valueOf(args[5]);
88-
int bulkSize = Integer.valueOf(args[6]);
86+
int totalDocs = Integer.valueOf(args[4]);
87+
int bulkSize = Integer.valueOf(args[5]);
8988

9089
int totalIterationCount = (int) Math.floor(totalDocs / bulkSize);
9190
// consider 40% of all iterations as warmup iterations
@@ -97,7 +96,7 @@ private void runBulkIndexBenchmark(String[] args) throws Exception {
9796
BenchmarkRunner benchmark = new BenchmarkRunner(
9897
warmupIterations,
9998
iterations,
100-
new BulkBenchmarkTask(bulkRequestExecutor(client, indexName, typeName), indexFilePath, warmupIterations, iterations, bulkSize)
99+
new BulkBenchmarkTask(bulkRequestExecutor(client, indexName), indexFilePath, warmupIterations, iterations, bulkSize)
101100
);
102101

103102
try {

client/benchmark/src/main/java/org/opensearch/client/benchmark/rest/RestClientBenchmark.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ protected RestClient client(String benchmarkTargetHost) {
6565
}
6666

6767
@Override
68-
protected BulkRequestExecutor bulkRequestExecutor(RestClient client, String indexName, String typeName) {
69-
return new RestBulkRequestExecutor(client, indexName, typeName);
68+
protected BulkRequestExecutor bulkRequestExecutor(RestClient client, String indexName) {
69+
return new RestBulkRequestExecutor(client, indexName);
7070
}
7171

7272
@Override
@@ -78,9 +78,9 @@ private static final class RestBulkRequestExecutor implements BulkRequestExecuto
7878
private final RestClient client;
7979
private final String actionMetadata;
8080

81-
RestBulkRequestExecutor(RestClient client, String index, String type) {
81+
RestBulkRequestExecutor(RestClient client, String index) {
8282
this.client = client;
83-
this.actionMetadata = String.format(Locale.ROOT, "{ \"index\" : { \"_index\" : \"%s\", \"_type\" : \"%s\" } }%n", index, type);
83+
this.actionMetadata = String.format(Locale.ROOT, "{ \"index\" : { \"_index\" : \"%s\" } }%n", index);
8484
}
8585

8686
@Override
@@ -91,7 +91,7 @@ public boolean bulkIndex(List<String> bulkData) {
9191
bulkRequestBody.append(bulkItem);
9292
bulkRequestBody.append("\n");
9393
}
94-
Request request = new Request("POST", "/geonames/type/_noop_bulk");
94+
Request request = new Request("POST", "/geonames/_noop_bulk");
9595
request.setJsonEntity(bulkRequestBody.toString());
9696
try {
9797
Response response = client.performRequest(request);

0 commit comments

Comments
 (0)