String yaml = convertToYaml(_id, response.getSourceAsBytesRef(), true); writer.write(yaml); System.out.println(" SUCC: Configuration for '"+_id+"' stored in "+filepath);
private static GetResult getResponseToGetResult(GetResponse response) { return new GetResult(response.getIndex(), response.getType(), response.getId(), response.getVersion(), response.isExists(), response.getSourceAsBytesRef(), response.getFields()); }
private Tuple<Long, Settings> toSettings(GetResponse singleGetResponse) { final BytesReference ref = singleGetResponse.getSourceAsBytesRef(); final String id = singleGetResponse.getId(); final long version = singleGetResponse.getVersion();
private Tuple<Long, Settings> toSettings(GetResponse singleGetResponse) { final BytesReference ref = singleGetResponse.getSourceAsBytesRef(); final String type = singleGetResponse.getType(); final long version = singleGetResponse.getVersion();
LoggingDeprecationHandler.INSTANCE, response.getSourceAsBytesRef())) { XContentParser.Token currentToken; while ((currentToken = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
/** * Called with the {@linkplain GetResponse} from loading the task from the results index. Called on the node that once had the task if * that node is part of the cluster or on the coordinating node if the node wasn't part of the cluster. */ void onGetFinishedTaskFromIndex(GetResponse response, ActionListener<GetTaskResponse> listener) throws IOException { if (false == response.isExists()) { listener.onFailure(new ResourceNotFoundException("task [{}] isn't running and hasn't stored its results", response.getId())); return; } if (response.isSourceEmpty()) { listener.onFailure(new ElasticsearchException("Stored task status for [{}] didn't contain any source!", response.getId())); return; } try (XContentParser parser = XContentHelper .createParser(xContentRegistry, LoggingDeprecationHandler.INSTANCE, response.getSourceAsBytesRef())) { TaskResult result = TaskResult.PARSER.apply(parser, null); listener.onResponse(new GetTaskResponse(result)); } } }
@Override public void onResponse(final GetResponse response) { if (response.isExists() && !response.isSourceEmpty()) { securityConfiguration = response.getSourceAsBytesRef(); latch.countDown(); logger.debug("Security configuration reloaded"); } }
String yaml = convertToYaml(_id, response.getSourceAsBytesRef(), true); writer.write(yaml); System.out.println(" SUCC: Configuration for '"+_id+"' stored in "+filepath);
public BytesReference getXContentSecurityConfigurationAsBR( final String type, final String id) throws MalformedConfigurationException { final GetResponse resp = client .prepareGet(securityConfigurationIndex, type, id) .setRefresh(true).setOperationThreaded(false).get(); if (resp.isExists()) { return resp.getSourceAsBytesRef(); } else { throw new MalformedConfigurationException("document type " + type + " with id " + id + " does not exists"); } }
@Override public void onResponse(MultiGetResponse multiGetItemResponses) { for (int i = 0; i < multiGetItemResponses.getResponses().length; i++) { MultiGetItemResponse itemResponse = multiGetItemResponses.getResponses()[i]; int slot = getRequestSlots.get(i); if (!itemResponse.isFailed()) { GetResponse getResponse = itemResponse.getResponse(); if (getResponse.isExists()) { PercolateRequest originalRequest = (PercolateRequest) percolateRequests.get(slot); percolateRequests.set(slot, new PercolateRequest(originalRequest, getResponse.getSourceAsBytesRef())); } else { logger.trace("mpercolate existing doc, item[{}] doesn't exist", slot); percolateRequests.set(slot, new DocumentMissingException(null, getResponse.getType(), getResponse.getId())); } } else { logger.trace("mpercolate existing doc, item[{}] failure {}", slot, itemResponse.getFailure()); percolateRequests.set(slot, itemResponse.getFailure()); } } new ASyncAction(request, percolateRequests, listener, clusterState).run(); }
@Override public void onResponse(GetResponse getResponse) { if (!getResponse.isExists()) { onFailure(new DocumentMissingException(null, request.getRequest().type(), request.getRequest().id())); return; } BytesReference docSource = getResponse.getSourceAsBytesRef(); TransportPercolateAction.super.doExecute(task, new PercolateRequest(request, docSource), listener); }
private Tuple<Long, Settings> toSettings(GetResponse singleGetResponse) { final BytesReference ref = singleGetResponse.getSourceAsBytesRef(); final String type = singleGetResponse.getType(); final long version = singleGetResponse.getVersion();
private Tuple<Long, Settings> toSettings(GetResponse singleGetResponse) { final BytesReference ref = singleGetResponse.getSourceAsBytesRef(); final String id = singleGetResponse.getId(); final long version = singleGetResponse.getVersion();
LoggingDeprecationHandler.INSTANCE, response.getSourceAsBytesRef())) { XContentParser.Token currentToken; while ((currentToken = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
LoggingDeprecationHandler.INSTANCE, response.getSourceAsBytesRef())) { XContentParser.Token currentToken; while ((currentToken = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
); documentSupplier.set(getResponse.getSourceAsBytesRef()); listener.onResponse(null); }, listener::onFailure));
); documentSupplier.set(getResponse.getSourceAsBytesRef()); listener.onResponse(null); }, listener::onFailure));
/** * Called with the {@linkplain GetResponse} from loading the task from the results index. Called on the node that once had the task if * that node is part of the cluster or on the coordinating node if the node wasn't part of the cluster. */ void onGetFinishedTaskFromIndex(GetResponse response, ActionListener<GetTaskResponse> listener) throws IOException { if (false == response.isExists()) { listener.onFailure(new ResourceNotFoundException("task [{}] isn't running and hasn't stored its results", response.getId())); return; } if (response.isSourceEmpty()) { listener.onFailure(new ElasticsearchException("Stored task status for [{}] didn't contain any source!", response.getId())); return; } try (XContentParser parser = XContentHelper.createParser(xContentRegistry, response.getSourceAsBytesRef())) { TaskResult result = TaskResult.PARSER.apply(parser, null); listener.onResponse(new GetTaskResponse(result)); } } }
/** * Called with the {@linkplain GetResponse} from loading the task from the results index. Called on the node that once had the task if * that node is part of the cluster or on the coordinating node if the node wasn't part of the cluster. */ void onGetFinishedTaskFromIndex(GetResponse response, ActionListener<GetTaskResponse> listener) throws IOException { if (false == response.isExists()) { listener.onFailure(new ResourceNotFoundException("task [{}] isn't running and hasn't stored its results", response.getId())); return; } if (response.isSourceEmpty()) { listener.onFailure(new ElasticsearchException("Stored task status for [{}] didn't contain any source!", response.getId())); return; } try (XContentParser parser = XContentHelper .createParser(xContentRegistry, LoggingDeprecationHandler.INSTANCE, response.getSourceAsBytesRef())) { TaskResult result = TaskResult.PARSER.apply(parser, null); listener.onResponse(new GetTaskResponse(result)); } } }
/** * Called with the {@linkplain GetResponse} from loading the task from the results index. Called on the node that once had the task if * that node is part of the cluster or on the coordinating node if the node wasn't part of the cluster. */ void onGetFinishedTaskFromIndex(GetResponse response, ActionListener<GetTaskResponse> listener) throws IOException { if (false == response.isExists()) { listener.onFailure(new ResourceNotFoundException("task [{}] isn't running and hasn't stored its results", response.getId())); return; } if (response.isSourceEmpty()) { listener.onFailure(new ElasticsearchException("Stored task status for [{}] didn't contain any source!", response.getId())); return; } try (XContentParser parser = XContentHelper .createParser(xContentRegistry, LoggingDeprecationHandler.INSTANCE, response.getSourceAsBytesRef())) { TaskResult result = TaskResult.PARSER.apply(parser, null); listener.onResponse(new GetTaskResponse(result)); } } }