Package org.elasticsearch.client.action.index

Examples of org.elasticsearch.client.action.index.IndexRequestBuilder.execute()


         
        }
      }
      // insert the document into elasticsearch
      response.setSource(mp);
      response.execute();
     
  }

  @Override
  public void close() throws IOException {
View Full Code Here


        XContentBuilder builder = XContentFactory.jsonBuilder();

        IndexRequestBuilder indexRequestbuilder = client.prepareIndex(INDEX_NAME, CHILD_TYPE_NAME, id);
        indexRequestbuilder = indexRequestbuilder.setParent(id);
        indexRequestbuilder = indexRequestbuilder.setSource(builder.map(objectMap));
        indexRequestbuilder.execute().actionGet();
    }

    /**
     * Execute a search based on a JSON String in QueryDSL format.
     *
 
View Full Code Here

    public void feedDoc(String twitterId, XContentBuilder b) {
//        String getIndexName() = new SimpleDateFormat("yyyyMMdd").format(tw.getCreatedAt());
        IndexRequestBuilder irb = client.prepareIndex(getIndexName(), getIndexType(), twitterId).
                setConsistencyLevel(WriteConsistencyLevel.DEFAULT).
                setSource(b);
        irb.execute().actionGet();
    }

    public void deleteById(String id) {
        DeleteResponse response = client.prepareDelete(getIndexName(), getIndexType(), id).
                execute().
View Full Code Here

    // This ensures that the write goes through if I can write to any nodes, which seems sensible
    // You could always check the response and handle minimal success like failure if you want
    irb.setConsistencyLevel(WriteConsistencyLevel.ONE);
 
    try {
      irb.execute().actionGet();
    }
    catch (org.elasticsearch.transport.RemoteTransportException e) {     
      boolean bDocAlreadyExists =
        e.contains(org.elasticsearch.index.engine.DocumentAlreadyExistsEngineException.class) // 0.18
          ||
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.