Search in sources :

Example 6 with IndexResponse

use of org.opensearch.action.index.IndexResponse in project fess by codelibs.

the class EsAbstractBehavior method delegateInsert.

// ===================================================================================
// Update
// ======
@Override
protected int delegateInsert(final Entity entity, final InsertOption<? extends ConditionBean> option) {
    final EsAbstractEntity esEntity = (EsAbstractEntity) entity;
    IndexRequestBuilder builder = createInsertRequest(esEntity);
    final IndexResponse response = builder.execute().actionGet(indexTimeout);
    esEntity.asDocMeta().id(response.getId());
    return response.getResult() == Result.CREATED ? 1 : 0;
}
Also used : IndexRequestBuilder(org.opensearch.action.index.IndexRequestBuilder) IndexResponse(org.opensearch.action.index.IndexResponse)

Aggregations

IndexRequestBuilder (org.opensearch.action.index.IndexRequestBuilder)6 IndexResponse (org.opensearch.action.index.IndexResponse)6