Package org.elasticsearch.action.get

Examples of org.elasticsearch.action.get.GetRequestBuilder


    public LinkedBlockingQueue<List<DeadLetter>> getDeadLetterQueue() {
        return deadLetterQueue;
    }

    public ResultMessage get(String messageId, String index) throws IndexMissingException, DocumentNotFoundException {
    GetRequestBuilder grb = new GetRequestBuilder(c, index);
    grb.setId(messageId);

    GetResponse r = c.get(grb.request()).actionGet();
   
    if (!r.isExists()) {
      throw new DocumentNotFoundException();
    }
   
View Full Code Here


    if (StringUtils.isBlank(key) || StringUtils.isBlank(appid)) {
      return map;
    }

    try {
      GetRequestBuilder grb = client().prepareGet().
          setIndex(stripRouting(appid)).setId(key).
          setRouting(getRouting(appid, key));

      if (type != null) {
        grb.setType(type);
      }

      map = grb.execute().actionGet().getSource();
    } catch (Exception e) {
      logger.warn(null, e);
    }
    return map;
  }
View Full Code Here

        String uuid = (String)docMap.get("uuid");
        return uuid;
    }

    protected String lookupUUID(String bucket, String id) {
        GetRequestBuilder builder = client.prepareGet();
        builder.setIndex(bucket);
        builder.setId(id);
        builder.setType(this.checkpointDocumentType);
        builder.setFetchSource(true);

        String bucketUUID = null;
        GetResponse response;
        ListenableActionFuture<GetResponse> laf = builder.execute();
        if(laf != null) {
            response = laf.actionGet();
            if(response.isExists()) {
            Map<String,Object> responseMap = response.getSourceAsMap();
            bucketUUID = this.getUUIDFromCheckpointDocSource(responseMap);
View Full Code Here

        String uuid = (String)docMap.get("uuid");
        return uuid;
    }

    protected String lookupUUID(String bucket, String id) {
        GetRequestBuilder builder = client.prepareGet();
        builder.setIndex(bucket);
        builder.setId(id);
        builder.setType(this.checkpointDocumentType);
        builder.setFetchSource(true);

        String bucketUUID = null;
        GetResponse response;
        ListenableActionFuture<GetResponse> laf = builder.execute();
        if(laf != null) {
            response = laf.actionGet();
            if(response.isExists()) {
            Map<String,Object> responseMap = response.getSourceAsMap();
            bucketUUID = this.getUUIDFromCheckpointDocSource(responseMap);
View Full Code Here

    }

    public JUser findByScreenName(String name) {
        try {
            name = name.toLowerCase();
            GetRequestBuilder grb = client.prepareGet(getIndexName(), getIndexType(), name);           
            GetResponse gr = grb.execute().actionGet();
            if (gr.isExists())
                return readDoc(gr.id(), gr.version(), gr.sourceAsMap());           
        } catch (Exception ex) {
            logger.error("Couldn't load user with screenName:" + name + " " + ex.getMessage());           
        }
View Full Code Here

     * @param indexPath
     * @param clazz
     * @return
     */
    public static <T extends Index> T get(IndexQueryPath indexPath, Class<T> clazz, String id) {
        GetRequestBuilder getRequestBuilder = getGetRequestBuilder(indexPath, id);
        GetResponse getResponse = getRequestBuilder.execute().actionGet();
        return getTFromGetResponse(clazz, getResponse);
    }
View Full Code Here

     * @param id
     * @return
     */
    public static GetResponse get(String indexName, String indexType, String id) {

        GetRequestBuilder getRequestBuilder = IndexClient.client.prepareGet(indexName, indexType, id);
        GetResponse getResponse = getRequestBuilder.execute().actionGet();
        return getResponse;
    }
View Full Code Here

    if (StringUtils.isBlank(key) || StringUtils.isBlank(appid)) {
      return map;
    }

    try {
      GetRequestBuilder grb = client().prepareGet().
          setIndex(stripRouting(appid)).setId(key).
          setRouting(getRouting(appid, key));

      if (type != null) {
        grb.setType(type);
      }

      map = grb.execute().actionGet().getSource();
    } catch (Exception e) {
      logger.warn(null, e);
    }
    return map;
  }
View Full Code Here

    if (StringUtils.isBlank(key) || StringUtils.isBlank(appid)) {
      return map;
    }

    try {
      GetRequestBuilder grb = client().prepareGet().setIndex(appid).setId(key);

      if (type != null) {
        grb.setType(type);
      }

      map = grb.execute().actionGet().getSource();
    } catch (Exception e) {
      logger.warn(null, e);
    }
    return map;
  }
View Full Code Here

    // TODO assert profiling
  }

  @Test
  public void fail_to_get_bad_query() throws Exception {
    GetRequestBuilder requestBuilder = searchClient.prepareGet()
      .setIndex("unknown")
      .setType("test")
      .setId("rule1");
    try {
      requestBuilder.get();
      fail();
    } catch (Exception e) {
      assertThat(e).isInstanceOf(IllegalStateException.class);
      assertThat(e.getMessage()).contains("Fail to execute ES get request for key 'rule1' on index 'unknown' on type 'test'");
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.get.GetRequestBuilder

Copyright © 2018 www.massapicom. 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.