public class BackgroundIndexer
extends java.lang.Object
implements java.lang.AutoCloseable
Constructor and Description |
---|
BackgroundIndexer(java.lang.String index,
java.lang.String type,
org.elasticsearch.client.Client client)
Start indexing in the background using a random number of threads.
|
BackgroundIndexer(java.lang.String index,
java.lang.String type,
org.elasticsearch.client.Client client,
int numOfDocs)
Start indexing in the background using a random number of threads.
|
BackgroundIndexer(java.lang.String index,
java.lang.String type,
org.elasticsearch.client.Client client,
int numOfDocs,
int writerCount)
Start indexing in the background using a given number of threads.
|
BackgroundIndexer(java.lang.String index,
java.lang.String type,
org.elasticsearch.client.Client client,
int numOfDocs,
int writerCount,
boolean autoStart,
java.util.Random random)
Start indexing in the background using a given number of threads.
|
Modifier and Type | Method and Description |
---|---|
void |
assertNoFailures() |
void |
close() |
void |
continueIndexing()
Continue indexing after it has paused.
|
void |
continueIndexing(int numOfDocs)
Continue indexing after it has paused.
|
java.lang.Throwable[] |
getFailures() |
java.util.Set<java.lang.String> |
getIds()
Returns the ID set of all documents indexed by this indexer run
|
void |
pauseIndexing()
Pausing indexing by setting current document limit to 0
|
void |
setMaxFieldSize(int fieldSize)
the minimum size in code points of a payload field in the indexed documents
|
void |
setMinFieldSize(int fieldSize)
the minimum size in code points of a payload field in the indexed documents
|
void |
start()
Start indexing with no limit to the number of documents
|
void |
start(int numOfDocs)
Start indexing
|
void |
stop()
Stop all background threads *
|
long |
totalIndexedDocs() |
public BackgroundIndexer(java.lang.String index, java.lang.String type, org.elasticsearch.client.Client client)
index
- index name to index intotype
- document typeclient
- client to usepublic BackgroundIndexer(java.lang.String index, java.lang.String type, org.elasticsearch.client.Client client, int numOfDocs)
index
- index name to index intotype
- document typeclient
- client to usenumOfDocs
- number of document to index before pausing. Set to -1 to have no limit.public BackgroundIndexer(java.lang.String index, java.lang.String type, org.elasticsearch.client.Client client, int numOfDocs, int writerCount)
index
- index name to index intotype
- document typeclient
- client to usenumOfDocs
- number of document to index before pausing. Set to -1 to have no limit.writerCount
- number of indexing threads to usepublic BackgroundIndexer(java.lang.String index, java.lang.String type, org.elasticsearch.client.Client client, int numOfDocs, int writerCount, boolean autoStart, java.util.Random random)
index
- index name to index intotype
- document typeclient
- client to usenumOfDocs
- number of document to index before pausing. Set to -1 to have no limit.writerCount
- number of indexing threads to useautoStart
- set to true to start indexing as soon as all threads have been created.random
- random instance to usepublic void start()
public void start(int numOfDocs)
numOfDocs
- number of document to index before pausing. Set to -1 to have no limit.public void pauseIndexing()
public void continueIndexing()
public void continueIndexing(int numOfDocs)
numOfDocs
- number of document to index before pausing. Set to -1 to have no limit.public void stop() throws java.lang.InterruptedException
java.lang.InterruptedException
public long totalIndexedDocs()
public java.lang.Throwable[] getFailures()
public void assertNoFailures()
public void setMinFieldSize(int fieldSize)
public void setMaxFieldSize(int fieldSize)
public void close() throws java.lang.Exception
close
in interface java.lang.AutoCloseable
java.lang.Exception
public java.util.Set<java.lang.String> getIds()