All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.avaje.ebeanservice.elastic.ElasticQueryUpdate Maven / Gradle / Ivy

package com.avaje.ebeanservice.elastic;

import com.avaje.ebean.plugin.BeanDocType;
import com.avaje.ebean.plugin.BeanType;
import com.avaje.ebeanservice.docstore.api.DocStoreQueryUpdate;
import com.avaje.ebeanservice.elastic.bulk.BulkUpdate;

import java.io.IOException;

/**
 * ElasticSearch implementation of DocStoreQueryUpdate.
 * 

* Uses the ElasticSearch BULK API. *

*/ public class ElasticQueryUpdate implements DocStoreQueryUpdate { private final BeanDocType beanDocType; private final BulkUpdate bulkUpdate; public ElasticQueryUpdate(BulkUpdate bulkUpdate, BeanType beanType) throws IOException { this.bulkUpdate = bulkUpdate; this.beanDocType = beanType.docStore(); } @Override public void store(Object idValue, T bean) throws IOException { beanDocType.index(idValue, bean, bulkUpdate.obtain()); } /** * Flush the current buffer sending the Bulk API request to ElasticSearch. */ @Override public void flush() throws IOException { bulkUpdate.flush(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy