Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into fix-awaits-time
- Loading branch information
Showing
60 changed files
with
2,095 additions
and
305 deletions.
There are no files selected for viewing
166 changes: 143 additions & 23 deletions
166
client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
132 changes: 132 additions & 0 deletions
132
client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetIndexRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.elasticsearch.client.indices; | ||
|
||
import org.elasticsearch.action.support.IndicesOptions; | ||
import org.elasticsearch.client.TimedRequest; | ||
import org.elasticsearch.common.util.ArrayUtils; | ||
|
||
/** | ||
* A request to retrieve information about an index. | ||
*/ | ||
public class GetIndexRequest extends TimedRequest { | ||
|
||
public enum Feature { | ||
ALIASES, | ||
MAPPINGS, | ||
SETTINGS; | ||
} | ||
|
||
static final Feature[] DEFAULT_FEATURES = new Feature[] { Feature.ALIASES, Feature.MAPPINGS, Feature.SETTINGS }; | ||
private Feature[] features = DEFAULT_FEATURES; | ||
private boolean humanReadable = false; | ||
private transient boolean includeDefaults = false; | ||
|
||
private final String[] indices; | ||
private IndicesOptions indicesOptions = IndicesOptions.fromOptions(false, false, true, true); | ||
private boolean local = false; | ||
|
||
public GetIndexRequest(String... indices) { | ||
this.indices = indices; | ||
} | ||
|
||
/** | ||
* The indices into which the mappings will be put. | ||
*/ | ||
public String[] indices() { | ||
return indices; | ||
} | ||
|
||
public IndicesOptions indicesOptions() { | ||
return indicesOptions; | ||
} | ||
|
||
public GetIndexRequest indicesOptions(IndicesOptions indicesOptions) { | ||
this.indicesOptions = indicesOptions; | ||
return this; | ||
} | ||
|
||
public final GetIndexRequest local(boolean local) { | ||
this.local = local; | ||
return this; | ||
} | ||
|
||
/** | ||
* Return local information, do not retrieve the state from master node (default: false). | ||
* @return <code>true</code> if local information is to be returned; | ||
* <code>false</code> if information is to be retrieved from master node (default). | ||
*/ | ||
public final boolean local() { | ||
return local; | ||
} | ||
|
||
public GetIndexRequest features(Feature... features) { | ||
if (features == null) { | ||
throw new IllegalArgumentException("features cannot be null"); | ||
} else { | ||
this.features = features; | ||
} | ||
return this; | ||
} | ||
|
||
public GetIndexRequest addFeatures(Feature... features) { | ||
if (this.features == DEFAULT_FEATURES) { | ||
return features(features); | ||
} else { | ||
return features(ArrayUtils.concat(features(), features, Feature.class)); | ||
} | ||
} | ||
|
||
public Feature[] features() { | ||
return features; | ||
} | ||
|
||
public GetIndexRequest humanReadable(boolean humanReadable) { | ||
this.humanReadable = humanReadable; | ||
return this; | ||
} | ||
|
||
public boolean humanReadable() { | ||
return humanReadable; | ||
} | ||
|
||
/** | ||
* Sets the value of "include_defaults". | ||
* | ||
* @param includeDefaults value of "include_defaults" to be set. | ||
* @return this request | ||
*/ | ||
public GetIndexRequest includeDefaults(boolean includeDefaults) { | ||
this.includeDefaults = includeDefaults; | ||
return this; | ||
} | ||
|
||
/** | ||
* Whether to return all default settings for each of the indices. | ||
* | ||
* @return <code>true</code> if defaults settings for each of the indices need to returned; | ||
* <code>false</code> otherwise. | ||
*/ | ||
public boolean includeDefaults() { | ||
return includeDefaults; | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.