Skip to content

Instantly share code, notes, and snippets.

@lukas-vlcek
Created April 22, 2011 08:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukas-vlcek/936267 to your computer and use it in GitHub Desktop.
Save lukas-vlcek/936267 to your computer and use it in GitHub Desktop.
Different API for the same timeout ?
// set timeout in actionGet()
IndexResponse indexResponse = ElasticSearchClient.getClient().prepareIndex()
.setIndex(_myIndexName_)
.setType(_myType_)
.setId(_myID_)
.setSource(_someContent_)
.execute()
.actionGet(5000); // <-- timeout set here
// using setTimeout
IndexResponse indexResponse = ElasticSearchClient.getClient().prepareIndex()
.setIndex(_myIndexName_)
.setType(_myType_)
.setId(_myID_)
.setSource(_someContent_)
.setTimeout( new TimeValue(5000) ) // <-- timeout set here
.execute()
.actionGet();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment