Package org.elasticsearch.test
Class BackgroundIndexer
- java.lang.Object
-
- org.elasticsearch.test.BackgroundIndexer
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class BackgroundIndexer extends java.lang.Object implements java.lang.AutoCloseable
-
-
Constructor Summary
Constructors Constructor Description BackgroundIndexer(java.lang.String index, java.lang.String type, Client client, int numOfDocs)
Start indexing in the background using a random number of threads.BackgroundIndexer(java.lang.String index, java.lang.String type, 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, Client client, int numOfDocs, int writerCount, boolean autoStart, java.util.Random random)
Start indexing in the background using a given number of threads.
-
Method Summary
Modifier and Type Method Description void
assertNoFailures()
void
close()
void
continueIndexing(int numOfDocs)
Continue indexing after it has paused.Client
getClient()
java.lang.Throwable[]
getFailures()
java.util.Set<java.lang.String>
getIds()
Returns the ID set of all documents indexed by this indexer runvoid
pauseIndexing()
Pausing indexing by setting current document limit to 0void
setAssertNoFailuresOnStop(boolean assertNoFailuresOnStop)
void
setIgnoreIndexingFailures(boolean ignoreIndexingFailures)
void
setRequestTimeout(TimeValue timeout)
void
start(int numOfDocs)
Start indexingvoid
stop()
Stop all background threads *long
totalIndexedDocs()
-
-
-
Constructor Detail
-
BackgroundIndexer
public BackgroundIndexer(java.lang.String index, java.lang.String type, Client client, int numOfDocs)
Start indexing in the background using a random number of threads. Indexing will be paused after numOfDocs docs has been indexed.- Parameters:
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.
-
BackgroundIndexer
public BackgroundIndexer(java.lang.String index, java.lang.String type, Client client, int numOfDocs, int writerCount)
Start indexing in the background using a given number of threads. Indexing will be paused after numOfDocs docs has been indexed.- Parameters:
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 use
-
BackgroundIndexer
public BackgroundIndexer(java.lang.String index, java.lang.String type, Client client, int numOfDocs, int writerCount, boolean autoStart, java.util.Random random)
Start indexing in the background using a given number of threads. Indexing will be paused after numOfDocs docs has been indexed.- Parameters:
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 use
-
-
Method Detail
-
setRequestTimeout
public void setRequestTimeout(TimeValue timeout)
-
setIgnoreIndexingFailures
public void setIgnoreIndexingFailures(boolean ignoreIndexingFailures)
-
start
public void start(int numOfDocs)
Start indexing- Parameters:
numOfDocs
- number of document to index before pausing. Set to -1 to have no limit.
-
pauseIndexing
public void pauseIndexing()
Pausing indexing by setting current document limit to 0
-
continueIndexing
public void continueIndexing(int numOfDocs)
Continue indexing after it has paused.- Parameters:
numOfDocs
- number of document to index before pausing. Set to -1 to have no limit.
-
stop
public void stop() throws java.lang.InterruptedException
Stop all background threads *- Throws:
java.lang.InterruptedException
-
totalIndexedDocs
public long totalIndexedDocs()
-
getFailures
public java.lang.Throwable[] getFailures()
-
assertNoFailures
public void assertNoFailures()
-
setAssertNoFailuresOnStop
public void setAssertNoFailuresOnStop(boolean assertNoFailuresOnStop)
-
close
public void close() throws java.lang.Exception
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
java.lang.Exception
-
getClient
public Client getClient()
-
getIds
public java.util.Set<java.lang.String> getIds()
Returns the ID set of all documents indexed by this indexer run
-
-