use of org.opensearch.action.index.IndexResponse in project fess by codelibs.
the class EsAbstractBehavior method delegateUpdate.
@Override
protected int delegateUpdate(final Entity entity, final UpdateOption<? extends ConditionBean> option) {
final EsAbstractEntity esEntity = (EsAbstractEntity) entity;
final IndexRequestBuilder builder = createUpdateRequest(esEntity);
final IndexResponse response = builder.execute().actionGet(indexTimeout);
final long seqNo = response.getSeqNo();
if (seqNo != SequenceNumbers.UNASSIGNED_SEQ_NO) {
esEntity.asDocMeta().seqNo(seqNo);
}
final long primaryTerm = response.getPrimaryTerm();
if (primaryTerm != SequenceNumbers.UNASSIGNED_PRIMARY_TERM) {
esEntity.asDocMeta().primaryTerm(primaryTerm);
}
return 1;
}
use of org.opensearch.action.index.IndexResponse in project fess by codelibs.
the class EsAbstractBehavior method delegateUpdate.
@Override
protected int delegateUpdate(final Entity entity, final UpdateOption<? extends ConditionBean> option) {
final EsAbstractEntity esEntity = (EsAbstractEntity) entity;
final IndexRequestBuilder builder = createUpdateRequest(esEntity);
final IndexResponse response = builder.execute().actionGet(indexTimeout);
final long seqNo = response.getSeqNo();
if (seqNo != SequenceNumbers.UNASSIGNED_SEQ_NO) {
esEntity.asDocMeta().seqNo(seqNo);
}
final long primaryTerm = response.getPrimaryTerm();
if (primaryTerm != SequenceNumbers.UNASSIGNED_PRIMARY_TERM) {
esEntity.asDocMeta().primaryTerm(primaryTerm);
}
return 1;
}
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;
}
use of org.opensearch.action.index.IndexResponse in project fess by codelibs.
the class EsAbstractBehavior method delegateUpdate.
@Override
protected int delegateUpdate(final Entity entity, final UpdateOption<? extends ConditionBean> option) {
final EsAbstractEntity esEntity = (EsAbstractEntity) entity;
final IndexRequestBuilder builder = createUpdateRequest(esEntity);
final IndexResponse response = builder.execute().actionGet(indexTimeout);
final long seqNo = response.getSeqNo();
if (seqNo != SequenceNumbers.UNASSIGNED_SEQ_NO) {
esEntity.asDocMeta().seqNo(seqNo);
}
final long primaryTerm = response.getPrimaryTerm();
if (primaryTerm != SequenceNumbers.UNASSIGNED_PRIMARY_TERM) {
esEntity.asDocMeta().primaryTerm(primaryTerm);
}
return 1;
}
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;
}
Aggregations