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)Start indexing in the background using a random number of threads.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 voidassertNoFailures()voidclose()voidcontinueIndexing()Continue indexing after it has paused.voidcontinueIndexing(int numOfDocs)Continue indexing after it has paused.ClientgetClient()java.lang.Throwable[]getFailures()java.util.Set<java.lang.String>getIds()Returns the ID set of all documents indexed by this indexer runvoidpauseIndexing()Pausing indexing by setting current document limit to 0voidsetAssertNoFailuresOnStop(boolean assertNoFailuresOnStop)voidsetMaxFieldSize(int fieldSize)the minimum size in code points of a payload field in the indexed documentsvoidsetMinFieldSize(int fieldSize)the minimum size in code points of a payload field in the indexed documentsvoidstart()Start indexing with no limit to the number of documentsvoidstart(int numOfDocs)Start indexingvoidstop()Stop all background threads *longtotalIndexedDocs()
-
-
-
Constructor Detail
-
BackgroundIndexer
public BackgroundIndexer(java.lang.String index, java.lang.String type, Client client)Start indexing in the background using a random number of threads.- Parameters:
index- index name to index intotype- document typeclient- client to use
-
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
-
start
public void start()
Start indexing with no limit to the number of documents
-
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()
Continue indexing after it has paused. No new document limit will be set
-
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.InterruptedExceptionStop all background threads *- Throws:
java.lang.InterruptedException
-
totalIndexedDocs
public long totalIndexedDocs()
-
getFailures
public java.lang.Throwable[] getFailures()
-
assertNoFailures
public void assertNoFailures()
-
setMinFieldSize
public void setMinFieldSize(int fieldSize)
the minimum size in code points of a payload field in the indexed documents
-
setMaxFieldSize
public void setMaxFieldSize(int fieldSize)
the minimum size in code points of a payload field in the indexed documents
-
setAssertNoFailuresOnStop
public void setAssertNoFailuresOnStop(boolean assertNoFailuresOnStop)
-
close
public void close() throws java.lang.Exception- Specified by:
closein 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
-
-