boolean allowNoIndices = defaultOptions.allowNoIndices();
boolean expandWildcardsOpen = defaultOptions.expandWildcardsOpen();
boolean expandWildcardsClosed = defaultOptions.expandWildcardsClosed();
if (header.containsKey("id")) {
GetRequest getRequest = new GetRequest(globalIndex);
percolateRequest.getRequest(getRequest);
for (Map.Entry<String, Object> entry : header.entrySet()) {
Object value = entry.getValue();
if ("id".equals(entry.getKey())) {
getRequest.id((String) value);
header.put("id", entry.getValue());
} else if ("index".equals(entry.getKey()) || "indices".equals(entry.getKey())) {
if (!allowExplicitIndex) {
throw new ElasticsearchIllegalArgumentException("explicit index in multi percolate is not allowed");
}
getRequest.index((String) value);
} else if ("type".equals(entry.getKey())) {
getRequest.type((String) value);
} else if ("preference".equals(entry.getKey())) {
getRequest.preference((String) value);
} else if ("routing".equals(entry.getKey())) {
getRequest.routing((String) value);
} else if ("percolate_index".equals(entry.getKey()) || "percolate_indices".equals(entry.getKey()) || "percolateIndex".equals(entry.getKey()) || "percolateIndices".equals(entry.getKey())) {
if (value instanceof String[]) {
percolateRequest.indices((String[]) value);
} else {
percolateRequest.indices(Strings.splitStringByCommaToArray((String) value));
}
} else if ("percolate_type".equals(entry.getKey()) || "percolateType".equals(entry.getKey())) {
percolateRequest.documentType((String) value);
} else if ("percolate_preference".equals(entry.getKey()) || "percolatePreference".equals(entry.getKey())) {
percolateRequest.preference((String) value);
} else if ("percolate_routing".equals(entry.getKey()) || "percolateRouting".equals(entry.getKey())) {
percolateRequest.routing((String) value);
} else if ("ignore_unavailable".equals(currentFieldName) || "ignoreUnavailable".equals(currentFieldName)) {
ignoreUnavailable = Boolean.valueOf((String) value);
} else if ("allow_no_indices".equals(currentFieldName) || "allowNoIndices".equals(currentFieldName)) {
allowNoIndices = Boolean.valueOf((String) value);
} else if ("expand_wildcards".equals(currentFieldName) || "expandWildcards".equals(currentFieldName)) {
String[] wildcards;
if (value instanceof String[]) {
wildcards = (String[]) value;
} else {
wildcards = Strings.splitStringByCommaToArray((String) value);
}
for (String wildcard : wildcards) {
if ("open".equals(wildcard)) {
expandWildcardsOpen = true;
} else if ("closed".equals(wildcard)) {
expandWildcardsClosed = true;
} else {
throw new ElasticsearchIllegalArgumentException("No valid expand wildcard value [" + wildcard + "]");
}
}
}
}
// Setting values based on get request, if needed...
if ((percolateRequest.indices() == null || percolateRequest.indices().length == 0) && getRequest.index() != null) {
percolateRequest.indices(getRequest.index());
}
if (percolateRequest.documentType() == null && getRequest.type() != null) {
percolateRequest.documentType(getRequest.type());
}
if (percolateRequest.routing() == null && getRequest.routing() != null) {
percolateRequest.routing(getRequest.routing());
}
if (percolateRequest.preference() == null && getRequest.preference() != null) {
percolateRequest.preference(getRequest.preference());
}
} else {
for (Map.Entry<String, Object> entry : header.entrySet()) {
Object value = entry.getValue();
if ("index".equals(entry.getKey()) || "indices".equals(entry.getKey())) {