@Override public UpdateByQueryResult createNewElasticSearchResult(String responseBody, int statusCode, String reasonPhrase, Gson gson) { return createNewElasticSearchResult(new UpdateByQueryResult(gson), responseBody, statusCode, reasonPhrase, gson); }
@Override public MultiSearchResult createNewElasticSearchResult(String responseBody, int statusCode, String reasonPhrase, Gson gson) { return createNewElasticSearchResult(new MultiSearchResult(gson), responseBody, statusCode, reasonPhrase, gson); }
@Override public SearchResult createNewElasticSearchResult(String responseBody, int statusCode, String reasonPhrase, Gson gson) { return createNewElasticSearchResult(new SearchResult(gson), responseBody, statusCode, reasonPhrase, gson); }
public Index prepareIndexRequest(String index, Map<String, Object> source, String id) { source.remove(Message.FIELD_ID); return new Index.Builder(source) .index(index) .type(IndexMapping.TYPE_MESSAGE) .id(id) .build(); }
public ResultMessage get(String messageId, String index) throws DocumentNotFoundException, IOException { final Get get = new Get.Builder(index, messageId).type(IndexMapping.TYPE_MESSAGE).build(); final DocumentResult result = client.execute(get); if (!result.isSucceeded()) { throw new DocumentNotFoundException(index, messageId); } @SuppressWarnings("unchecked") final Map<String, Object> message = (Map<String, Object>) result.getSourceAsObject(Map.class, false); return ResultMessage.parseFromSource(result.getId(), result.getIndex(), message); }
/** * Index and ID parameters are mandatory but type is optional (_all will be used for type if left blank). * <br/><br/> * The get API allows for _type to be optional. Set it to _all in order to fetch the * first document matching the id across all types. */ public Builder(String index, String id) { this.index(index); this.id(id); this.type("_all"); }
@Override public BulkResult createNewElasticSearchResult(String responseBody, int statusCode, String reasonPhrase, Gson gson) { return createNewElasticSearchResult(new BulkResult(gson), responseBody, statusCode, reasonPhrase, gson); }
@Override public CountResult createNewElasticSearchResult(String responseBody, int statusCode, String reasonPhrase, Gson gson) { return createNewElasticSearchResult(new CountResult(gson), responseBody, statusCode, reasonPhrase, gson); }
@Override public CatResult createNewElasticSearchResult(String responseBody, int statusCode, String reasonPhrase, Gson gson) { return createNewElasticSearchResult(new CatResult(gson), responseBody, statusCode, reasonPhrase, gson); }
public Double getCount() { Double count = null; if (isSucceeded) { count = getSourceAsObject(Double.class); } return count; }
@Override public MultiGet build() { return new MultiGet(this); } }
@Override public DeleteByQuery build() { return new DeleteByQuery(this); } }
/** * * @param routing A comma-separated list of routing values to take into account when * determining which shards a request would be executed against. */ public Builder routing(String routing) { setParameter("routing", routing); return this; }
public VersionBuilder(Object payload, Long version) { super(payload); this.setParameter(Parameters.VERSION, version); } }
@Override public Search build() { return new Search(this); } }
@Override public SearchShards build() { return new SearchShards(this); } }
@Override public Count build() { return new Count(this); } }
@Override public MultiSearch build() { return new MultiSearch(this); } }
public VersionBuilder(String query) { super(query); this.setParameter(Parameters.VERSION, "true"); } }