/** * Ensure that the {@link IndexRequest}'s content type is supported by the Bulk API and that it conforms to the * current {@link BulkRequest}'s content type (if it's known at the time of this method get called). * * @return the {@link IndexRequest}'s content type */ static XContentType enforceSameContentType(IndexRequest indexRequest, @Nullable XContentType xContentType) { XContentType requestContentType = indexRequest.getContentType(); if (requestContentType != XContentType.JSON && requestContentType != XContentType.SMILE) { throw new IllegalArgumentException("Unsupported content-type found for request with content-type [" + requestContentType + "], only JSON and SMILE are supported"); } if (xContentType == null) { return requestContentType; } if (requestContentType != xContentType) { throw new IllegalArgumentException("Mismatching content-type found for request with content-type [" + requestContentType + "], previous requests have content-type [" + xContentType + "]"); } return xContentType; }
public <T> Page<T> continueScroll(@Nullable String scrollId, long scrollTimeInMillis, Class<T> clazz) { SearchScrollRequest request = new SearchScrollRequest(scrollId); request.scroll(TimeValue.timeValueMillis(scrollTimeInMillis)); SearchResponse response; try { response = client.searchScroll(request); } catch (IOException e) { throw new ElasticsearchException("Error for search request with scroll: " + request.toString(), e); } return resultsMapper.mapResults(response, clazz, Pageable.unpaged()); }
public <T> Page<T> continueScroll(@Nullable String scrollId, long scrollTimeInMillis, Class<T> clazz, SearchResultMapper mapper) { SearchScrollRequest request = new SearchScrollRequest(scrollId); request.scroll(TimeValue.timeValueMillis(scrollTimeInMillis)); SearchResponse response; try { response = client.searchScroll(request); } catch (IOException e) { throw new ElasticsearchException("Error for search request with scroll: " + request.toString(), e); } return mapper.mapResults(response, clazz, Pageable.unpaged()); }
/** * Operating System level information. */ @Nullable public OsInfo getOs() { return this.os; }
/** * Process level statistics. */ @Nullable public ProcessStats getProcess() { return process; }
/** * An optional version stored with the pipeline so that it can be used to determine if the pipeline should be updated / replaced. * * @return {@code null} if not supplied. */ @Nullable public Integer getVersion() { return version; }
/** * Returns snapshot state; {@code null} if the state is unknown. * * @return snapshot state */ @Nullable public SnapshotState state() { return state; }
/** * Returns the index name of the shard to explain, or {@code null} to use any unassigned shard (see {@link #useAnyUnassignedShard()}). */ @Nullable public String getIndex() { return this.index; }
/** * Sets the text to provide suggestions for. The suggest text is a required option that needs * to be set either via this setter or via the {@link org.elasticsearch.search.suggest.SuggestionBuilder#text(String)} method. * <p> * The suggest text gets analyzed by the suggest analyzer or the suggest field search analyzer. * For each analyzed token, suggested terms are suggested if possible. */ public SuggestBuilder setGlobalText(@Nullable String globalText) { this.globalText = globalText; return this; }
/** * Get the explanation for this decision. */ @Nullable public abstract String getExplanation();
@Override @Nullable public String label() { // Multi decisions have no labels return null; }
/** * Returns node id where failure occurred * * @return node id */ @Nullable public String nodeId() { return nodeId; }
/** * Cluster Health Status, only populated on master nodes. */ @Nullable public ClusterHealthStatus clusterStatus() { return clusterStatus; }
/** * Returns the relocating target node, or {@code null} if the shard is not in the {@link ShardRoutingState#RELOCATING} state. */ @Nullable public DiscoveryNode getRelocationTargetNode() { return relocationTargetNode; }
/** * Returns custom headers that have been added, or null if none have been set. */ @Nullable public Map<String, List<String>> getHeaders() { return customHeaders; } }
/** * Gets the store exception when trying to read the store, if there was an error. If * there was no error, returns {@code null}. */ @Nullable public Exception getStoreException() { return storeException; }
/** * If set, a string representing that the segment is part of a merge, with the value representing the * group of segments that represent this merge. */ @Nullable public String getMergeId() { return this.mergeId; }
/** * Sets the type of the document to fetch. */ public GetRequest type(@Nullable String type) { if (type == null) { type = "_all"; } this.type = type; return this; }
/** * Return the shard with the provided id, or null if there is no such shard. */ @Override @Nullable public IndexShard getShardOrNull(int shardId) { return shards.get(shardId); }