mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-25 09:28:27 +00:00
[TEST] make filter_path a default parameter in java rest runner
Closes #11351
This commit is contained in:
parent
820314db4e
commit
44fe99a3a8
@ -56,10 +56,6 @@
|
||||
"options" : ["node", "indices", "shards"],
|
||||
"default" : "node"
|
||||
},
|
||||
"filter_path": {
|
||||
"type" : "list",
|
||||
"description" : "A comma-separated list of fields to include in the returned response"
|
||||
},
|
||||
"types" : {
|
||||
"type" : "list",
|
||||
"description" : "A comma-separated list of document types for the `indexing` index metric"
|
||||
|
@ -72,10 +72,6 @@
|
||||
"type" : "boolean",
|
||||
"description" : "Specify whether query terms should be lowercased"
|
||||
},
|
||||
"filter_path": {
|
||||
"type" : "list",
|
||||
"description" : "A comma-separated list of fields to include in the returned response"
|
||||
},
|
||||
"preference": {
|
||||
"type" : "string",
|
||||
"description" : "Specify the node or shard the operation should be performed on (default: random)"
|
||||
|
@ -21,6 +21,7 @@ package org.elasticsearch.test.rest.client;
|
||||
import com.carrotsearch.randomizedtesting.RandomizedTest;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
@ -41,6 +42,7 @@ import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@ -50,6 +52,8 @@ import java.util.concurrent.TimeUnit;
|
||||
public class RestClient implements Closeable {
|
||||
|
||||
private static final ESLogger logger = Loggers.getLogger(RestClient.class);
|
||||
//query_string params that don't need to be declared in the spec, thay are supported by default
|
||||
private static final Set<String> ALWAYS_ACCEPTED_QUERY_STRING_PARAMS = Sets.newHashSet("pretty", "source", "filter_path");
|
||||
|
||||
private final RestSpec restSpec;
|
||||
private final CloseableHttpClient httpClient;
|
||||
@ -172,10 +176,11 @@ public class RestClient implements Closeable {
|
||||
if (restApi.getPathParts().contains(entry.getKey())) {
|
||||
pathParts.put(entry.getKey(), entry.getValue());
|
||||
} else {
|
||||
if (!restApi.getParams().contains(entry.getKey())) {
|
||||
if (restApi.getParams().contains(entry.getKey()) || ALWAYS_ACCEPTED_QUERY_STRING_PARAMS.contains(entry.getKey())) {
|
||||
httpRequestBuilder.addParam(entry.getKey(), entry.getValue());
|
||||
} else {
|
||||
throw new IllegalArgumentException("param [" + entry.getKey() + "] not supported in [" + restApi.getName() + "] api");
|
||||
}
|
||||
httpRequestBuilder.addParam(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user