Skip to content

Commit 81d7038

Browse files
committed
[Type removal] Remove _type support in bulk indexing from client benchmark
Signed-off-by: Suraj Singh <[email protected]>
1 parent 03fbca3 commit 81d7038

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

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)