Send data async action future.

@param jsonSource the json source
@param index      the index
@param type       the type
@param id         the id
@return the action future
180722
public ActionFuture<IndexResponse> sendDataAsync(
            String jsonSource, String index, String type, String id) {
        return indexQueryAsync(buildIndexRequest(jsonSource, index, type, id));
    }
694573
private Map<String, Object> getEntity(String type, String id) throws StorageException {
        try {
            JestResult response = esClient.execute(new Get.Builder(getIndexName(), id).type(type).build());
            if (!response.isSucceeded()) {
                return null;
            }
            return response.getSourceAsObject(Map.class);
        } catch (Exception e) {
            throw new StorageException(e);
        }
    }
1082475
public JSONObject getJSONObject(int index) throws JSONException {
		Object object = get(index);
		if (object instanceof JSONObject) {
			return (JSONObject) object;
		}
		else {
			throw JSON.typeMismatch(index, object, "JSONObject");
		}
	}
978085
public FutureAPIResponse sendQueryAsFuture(Map<String, Object> query)
      throws ExecutionException, InterruptedException, IOException {
    RequestBuilder builder = new RequestBuilder("POST");
    builder.setUrl(apiUrl + "/queries.json");

    // handle DateTime separately
    GsonBuilder gsonBuilder = new GsonBuilder();
    gsonBuilder.registerTypeAdapter(DateTime.class, new DateTimeAdapter());
    Gson gson = gsonBuilder.create();

    String requestJsonString = gson.toJson(query);
    builder.setBody(requestJsonString);
    builder.setHeader("Content-Type", "application/json");
    builder.setHeader("Content-Length", "" + requestJsonString.length());
    return new FutureAPIResponse(client.executeRequest(builder.build(), getHandler()));
  }
1057328
public void index(String indexName, String indexType, List<CharSequence> jsons) {
        index(
                jsons.stream()
                        .map(json -> new IndexRequest.IndexRequestBuilder(indexName, indexType, json.toString()).build())
                        .collect(toList())
        );
    }
372145
public boolean createOrUpdateData(String indexName, String type, String id, Object obj) {
        IndexResponse response = getClient().prepareIndex(indexName, type).setId(id).setSource(Lang.obj2map(obj)).execute().actionGet();
        return response.getResult() == DocWriteResponse.Result.CREATED || response.getResult() == DocWriteResponse.Result.UPDATED;
    }
405305
private void updateEntity(String type, String id, XContentBuilder source) throws StorageException {
        try {
            String doc = source.string();
            /* JestResult response = */esClient.execute(new Index.Builder(doc)
                    .setParameter(Parameters.OP_TYPE, "index").index(getIndexName()).type(type).id(id).build()); //$NON-NLS-1$
        } catch (Exception e) {
            throw new StorageException(e);
        }
    }
1008347
public void deleteByQuery(String index, String type) throws IOException {
        logger.debug("deleteByQuery [{}]/[{}]", index, type);

        String deleteByQuery = "{\n" +
                "  \"query\": {\n" +
                "    \"match_all\": {}\n" +
                "  }\n" +
                "}";

        HttpEntity entity = EntityBuilder.create().setText(deleteByQuery).setContentType(ContentType.APPLICATION_JSON).build();
        Response restResponse = lowLevelClient.performRequest("POST", "/" + index + "/" + type + "/_delete_by_query", Collections.emptyMap(), entity);
        Map<String, Object> response = asMap(restResponse);
        logger.debug("reindex response: {}", response);
    }
942945
public static BaasResult<JsonObject> fetchDataSync(String id){
        if (id == null) throw new IllegalArgumentException("asset id cannot be null");
        BaasBox box = BaasBox.getDefaultChecked();
        AssetDataRequest req = new AssetDataRequest(box,id, RequestOptions.DEFAULT,null);
        return box.submitSync(req);
    }
1205983
public UpdateResponse upsertDataWithObjectMapper(Object sourceObject,
            String index, String type, String id) {
        return upsertData(
                JMElasticsearchUtil.buildSourceByJsonMapper(sourceObject),
                index, type, id);
    }
706413
@Override
    public java.util.concurrent.Future<ListApplicationsResult> listApplicationsAsync(
            com.amazonaws.handlers.AsyncHandler<ListApplicationsRequest, ListApplicationsResult> asyncHandler) {

        return listApplicationsAsync(new ListApplicationsRequest(), asyncHandler);
    }
341848
public void createOrUpdateData(String indexName, String type, List<NutMap> list) {
        BulkRequestBuilder bulkRequest = getClient().prepareBulk();
        if (list.size() > 0) {
            for (NutMap nutMap : list) {
                bulkRequest.add(getClient().prepareIndex(indexName, type).setId(nutMap.getString("id")).setSource(Lang.obj2map(nutMap.get("obj"))));
            }
            bulkRequest.execute().actionGet();
        }
    }
978898
public static Result onUiAsync(Action action) {
        if (Looper.myLooper() == Looper.getMainLooper()) {
            action.call();
            return new ActionAsyncTask(action, true);
        }
        ActionAsyncTask task = new ActionAsyncTask(action);
        getUiPoster().async(task);
        return task;
    }
1185053
public void load(AjaxRequestTarget ajaxRequestTarget, int index)
	{
		ajaxRequestTarget.appendJavaScript(this.load(index).render().toString());
	}
1139832
public IndexResponse sendData(Map<String, ?> source, String index,
            String type, String id) {
        return indexQuery(buildIndexRequest(source, index, type, id));
    }
1055515
static ContinuableFuture<Void> execute(final Try.Runnable<? extends Exception> action) {
        return execute(new FutureTask<Void>(FN.toCallable(action)), SERIAL_EXECUTOR);
    }
877522
public <T extends DataSource> FutureData<ManagedSource> update(String name, T source, ManagedSource id) {
        return update(name, source, id, false);
    }