Examples of XContentRestResponse


Examples of org.elasticsearch.rest.XContentRestResponse

            // + how to combine with existing filter?

            logger.info("Finished reindexing of index " + searchIndexName + " into " + newIndexName + ", query " + filter);

            if (!internalCall)
                channel.sendResponse(new XContentRestResponse(request, OK, builder));
        } catch (IOException ex) {
            if (!internalCall) {
                try {
                    channel.sendResponse(new XContentThrowableRestResponse(request, ex));
                } catch (Exception ex2) {
View Full Code Here

Examples of org.elasticsearch.rest.XContentRestResponse

  @Override
  public void onResponse(Response response) {
    try {
      NodeResponse nodeInfo = response.getSuccessNodeResponse();
      if (nodeInfo == null) {
        restChannel.sendResponse(new XContentRestResponse(restRequest, RestStatus.NOT_FOUND, buildMessageDocument(
            restRequest, "No RemoteRiver found for name: " + actionRequest.getRiverName())));
      } else {
        handleRiverResponse(nodeInfo);
      }
    } catch (Exception e) {
View Full Code Here

Examples of org.elasticsearch.rest.XContentRestResponse

                restRequest, restChannel) {

              @Override
              protected void handleRiverResponse(NodeFullUpdateResponse nodeInfo) throws Exception {
                if (actionRequest.isSpaceKeyRequest() && !nodeInfo.spaceFound) {
                  restChannel.sendResponse(new XContentRestResponse(restRequest, RestStatus.NOT_FOUND,
                      buildMessageDocument(restRequest, "Space '" + spaceKey
                          + "' is not indexed by RemoteRiver with name: " + riverName)));
                } else {
                  restChannel.sendResponse(new XContentRestResponse(restRequest, OK, buildMessageDocument(restRequest,
                      "Scheduled full reindex for Spaces: " + nodeInfo.reindexedSpaces)));
                }
              }

            });
View Full Code Here

Examples of org.elasticsearch.rest.XContentRestResponse

              XContentBuilder builder = RestXContentBuilder.restContentBuilder(restRequest);
              builder.startObject();
              builder.field("river_names", allRivers);
              builder.endObject();
              restChannel.sendResponse(new XContentRestResponse(restRequest, RestStatus.OK, builder));
            } catch (Exception e) {
              onFailure(e);
            }
          }
View Full Code Here

Examples of org.elasticsearch.rest.XContentRestResponse

            new JRMgmBaseActionListener<JRLifecycleRequest, JRLifecycleResponse, NodeJRLifecycleResponse>(
                actionRequest, restRequest, restChannel) {

              @Override
              protected void handleRiverResponse(NodeJRLifecycleResponse nodeInfo) throws Exception {
                restChannel.sendResponse(new XContentRestResponse(restRequest, OK, buildMessageDocument(restRequest,
                    "Command successful")));
              }

            });
  }
View Full Code Here

Examples of org.elasticsearch.rest.XContentRestResponse

              XContentBuilder builder = RestXContentBuilder.restContentBuilder(restRequest);
              builder.startObject();
              builder.field("river_names", allRivers);
              builder.endObject();
              restChannel.sendResponse(new XContentRestResponse(restRequest, RestStatus.OK, builder));
            } catch (Exception e) {
              onFailure(e);
            }
          }
View Full Code Here

Examples of org.elasticsearch.rest.XContentRestResponse

  @Override
  public void onResponse(Response response) {
    try {
      NodeResponse nodeInfo = response.getSuccessNodeResponse();
      if (nodeInfo == null) {
        restChannel.sendResponse(new XContentRestResponse(restRequest, RestStatus.NOT_FOUND, buildMessageDocument(
            restRequest, "No JiraRiver found for name: " + actionRequest.getRiverName())));
      } else {
        handleJiraRiverResponse(nodeInfo);
      }
    } catch (Exception e) {
View Full Code Here

Examples of org.elasticsearch.rest.XContentRestResponse

  @Override
  public void onResponse(Response response) {
    try {
      NodeResponse nodeInfo = response.getSuccessNodeResponse();
      if (nodeInfo == null) {
        restChannel.sendResponse(new XContentRestResponse(restRequest, RestStatus.NOT_FOUND, buildMessageDocument(
            restRequest, "No RemoteRiver found for name: " + actionRequest.getRiverName())));
      } else {
        handleRiverResponse(nodeInfo);
      }
    } catch (Exception e) {
View Full Code Here

Examples of org.elasticsearch.rest.XContentRestResponse

            exportRequest.types(splitTypes(request.param("type")));
            exportRequest.preference(request.param("preference", "_primary"));
        } catch (Exception e) {
            try {
                XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
                channel.sendResponse(new XContentRestResponse(request, BAD_REQUEST, builder.startObject().field("error", e.getMessage()).endObject()));
            } catch (IOException e1) {
                logger.error("Failed to send failure response", e1);
            }
            return;
        }

        client.execute(action(), exportRequest, new ActionListener<ExportResponse>() {

            public void onResponse(ExportResponse response) {
                try {
                    XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
                    response.toXContent(builder, request);
                    channel.sendResponse(new XContentRestResponse(request, OK, builder));
                } catch (Exception e) {
                    onFailure(e);
                }
            }
View Full Code Here

Examples of org.elasticsearch.rest.XContentRestResponse

        } catch (Exception e) {
            try {
                XContentBuilder builder = RestXContentBuilder
                        .restContentBuilder(
                                request);
                channel.sendResponse(new XContentRestResponse(request,
                        BAD_REQUEST, builder.startObject().field("error",
                        e.getMessage()).endObject()));
            } catch (IOException e1) {
                logger.error("Failed to send failure response", e1);
            }
            return;
        }

        client.execute(action(), searchIntoRequest,
                new ActionListener<SearchIntoResponse>() {

                    public void onResponse(SearchIntoResponse response) {
                        try {
                            XContentBuilder builder = RestXContentBuilder
                                    .restContentBuilder(
                                            request);
                            response.toXContent(builder, request);
                            channel.sendResponse(new XContentRestResponse(
                                    request, OK, builder));
                        } catch (Exception e) {
                            onFailure(e);
                        }
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.