Class SolrClient
- java.lang.Object
- 
- org.apache.solr.client.solrj.SolrClient
 
- 
- All Implemented Interfaces:
- Closeable,- Serializable,- AutoCloseable
 - Direct Known Subclasses:
- BaseHttpSolrClient,- CloudSolrClient,- ConcurrentUpdateHttp2SolrClient,- ConcurrentUpdateSolrClient,- HttpSolrClientBase,- LBSolrClient
 
 public abstract class SolrClient extends Object implements Serializable, Closeable Abstraction through which all communication with a Solr server may be routed- Since:
- 5.0, replaced SolrServer
- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected StringdefaultCollection
 - 
Constructor SummaryConstructors Constructor Description SolrClient()
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description UpdateResponseadd(String collection, Collection<SolrInputDocument> docs)Adds a collection of documentsUpdateResponseadd(String collection, Collection<SolrInputDocument> docs, int commitWithinMs)Adds a collection of documents, specifying max time before they become committedUpdateResponseadd(String collection, Iterator<SolrInputDocument> docIterator)Adds the documents supplied by the given iterator.UpdateResponseadd(String collection, SolrInputDocument doc)Adds a single documentUpdateResponseadd(String collection, SolrInputDocument doc, int commitWithinMs)Adds a single document specifying max time before it becomes committedUpdateResponseadd(Collection<SolrInputDocument> docs)Adds a collection of documentsUpdateResponseadd(Collection<SolrInputDocument> docs, int commitWithinMs)Adds a collection of documents, specifying max time before they become committedUpdateResponseadd(Iterator<SolrInputDocument> docIterator)Adds the documents supplied by the given iterator.UpdateResponseadd(SolrInputDocument doc)Adds a single documentUpdateResponseadd(SolrInputDocument doc, int commitWithinMs)Adds a single document specifying max time before it becomes committedUpdateResponseaddBean(Object obj)Adds a single beanUpdateResponseaddBean(Object obj, int commitWithinMs)Adds a single bean specifying max time before it becomes committedUpdateResponseaddBean(String collection, Object obj)Adds a single beanUpdateResponseaddBean(String collection, Object obj, int commitWithinMs)Adds a single bean specifying max time before it becomes committedUpdateResponseaddBeans(String collection, Collection<?> beans)Adds a collection of beansUpdateResponseaddBeans(String collection, Collection<?> beans, int commitWithinMs)Adds a collection of beans specifying max time before they become committedUpdateResponseaddBeans(String collection, Iterator<?> beanIterator)Adds the beans supplied by the given iterator.UpdateResponseaddBeans(Collection<?> beans)Adds a collection of beansUpdateResponseaddBeans(Collection<?> beans, int commitWithinMs)Adds a collection of beans specifying max time before they become committedUpdateResponseaddBeans(Iterator<?> beanIterator)Adds the beans supplied by the given iterator.UpdateResponsecommit()Performs an explicit commit, causing pending documents to be committed for indexingUpdateResponsecommit(boolean waitFlush, boolean waitSearcher)Performs an explicit commit, causing pending documents to be committed for indexingUpdateResponsecommit(boolean waitFlush, boolean waitSearcher, boolean softCommit)Performs an explicit commit, causing pending documents to be committed for indexingUpdateResponsecommit(String collection)Performs an explicit commit, causing pending documents to be committed for indexingUpdateResponsecommit(String collection, boolean waitFlush, boolean waitSearcher)Performs an explicit commit, causing pending documents to be committed for indexingUpdateResponsecommit(String collection, boolean waitFlush, boolean waitSearcher, boolean softCommit)Performs an explicit commit, causing pending documents to be committed for indexingUpdateResponsedeleteById(String id)Deletes a single document by unique ID.UpdateResponsedeleteById(String id, int commitWithinMs)Deletes a single document by unique ID, specifying max time before commit.UpdateResponsedeleteById(String collection, String id)Deletes a single document by unique ID.UpdateResponsedeleteById(String collection, String id, int commitWithinMs)Deletes a single document by unique ID, specifying max time before commit.UpdateResponsedeleteById(String collection, List<String> ids)Deletes a list of documents by unique ID.UpdateResponsedeleteById(String collection, List<String> ids, int commitWithinMs)Deletes a list of documents by unique ID, specifying max time before commit.UpdateResponsedeleteById(List<String> ids)Deletes a list of documents by unique ID.UpdateResponsedeleteById(List<String> ids, int commitWithinMs)Deletes a list of documents by unique ID, specifying max time before commit.UpdateResponsedeleteByQuery(String query)Deletes documents from the index based on a queryUpdateResponsedeleteByQuery(String query, int commitWithinMs)Deletes documents from the index based on a query, specifying max time before commitUpdateResponsedeleteByQuery(String collection, String query)Deletes documents from the index based on a queryUpdateResponsedeleteByQuery(String collection, String query, int commitWithinMs)Deletes documents from the index based on a query, specifying max time before commitDocumentObjectBindergetBinder()Get theDocumentObjectBinderfor this client.SolrDocumentgetById(String id)Retrieves the SolrDocument associated with the given identifier.SolrDocumentgetById(String collection, String id)Retrieves the SolrDocument associated with the given identifier.SolrDocumentgetById(String collection, String id, SolrParams params)Retrieves the SolrDocument associated with the given identifier and uses the SolrParams to execute the request.SolrDocumentListgetById(String collection, Collection<String> ids)Retrieves the SolrDocuments associated with the given identifiers.SolrDocumentListgetById(String collection, Collection<String> ids, SolrParams params)Retrieves the SolrDocuments associated with the given identifiers and uses the SolrParams to execute the request.SolrDocumentgetById(String id, SolrParams params)Retrieves the SolrDocument associated with the given identifier and uses the SolrParams to execute the request.SolrDocumentListgetById(Collection<String> ids)Retrieves the SolrDocuments associated with the given identifiers.SolrDocumentListgetById(Collection<String> ids, SolrParams params)Retrieves the SolrDocuments associated with the given identifiers and uses the SolrParams to execute the request.SolrRequest.SolrClientContextgetContext()This method defines the context in which this Solr client is being used (e.g.StringgetDefaultCollection()Gets the collection used by default for collection or core-based requestsUpdateResponseoptimize()Performs an explicit optimize, causing a merge of all segments to one.UpdateResponseoptimize(boolean waitFlush, boolean waitSearcher)Performs an explicit optimize, causing a merge of all segments to one.UpdateResponseoptimize(boolean waitFlush, boolean waitSearcher, int maxSegments)Performs an explicit optimize, causing a merge of all segments to one.UpdateResponseoptimize(String collection)Performs an explicit optimize, causing a merge of all segments to one.UpdateResponseoptimize(String collection, boolean waitFlush, boolean waitSearcher)Performs an explicit optimize, causing a merge of all segments to one.UpdateResponseoptimize(String collection, boolean waitFlush, boolean waitSearcher, int maxSegments)Performs an explicit optimize, causing a merge of all segments to one.SolrPingResponseping()Issues a ping request to check if the server is aliveSolrPingResponseping(String collection)Issues a ping request to check if the collection's replicas are aliveQueryResponsequery(String collection, SolrParams params)Performs a query to the Solr serverQueryResponsequery(String collection, SolrParams params, SolrRequest.METHOD method)Performs a query to the Solr serverQueryResponsequery(SolrParams params)Performs a query to the Solr serverQueryResponsequery(SolrParams params, SolrRequest.METHOD method)Performs a query to the Solr serverQueryResponsequeryAndStreamResponse(String collection, SolrParams params, FastStreamingDocsCallback callback)QueryResponsequeryAndStreamResponse(String collection, SolrParams params, StreamingResponseCallback callback)Query solr, and stream the results.QueryResponsequeryAndStreamResponse(SolrParams params, StreamingResponseCallback callback)Query solr, and stream the results.NamedList<Object>request(SolrRequest<?> request)Execute a request against a Solr server using the default collectionabstract NamedList<Object>request(SolrRequest<?> request, String collection)Execute a request against a Solr server for a given collectionUpdateResponserollback()Performs a rollback of all non-committed documents pending.UpdateResponserollback(String collection)Performs a rollback of all non-committed documents pending.
 
- 
- 
- 
Field Detail- 
defaultCollectionprotected String defaultCollection 
 
- 
 - 
Method Detail- 
addpublic UpdateResponse add(String collection, Collection<SolrInputDocument> docs) throws SolrServerException, IOException Adds a collection of documents- Parameters:
- collection- the Solr collection to add documents to
- docs- the collection of documents
- Returns:
- an UpdateResponsefrom the server
- Throws:
- IOException- if there is a communication error with the server
- SolrServerException- if there is an error on the server
- Since:
- Solr 5.1
 
 - 
addpublic UpdateResponse add(Collection<SolrInputDocument> docs) throws SolrServerException, IOException Adds a collection of documents- Parameters:
- docs- the collection of documents
- Returns:
- an UpdateResponsefrom the server
- Throws:
- IOException- if there is a communication error with the server
- SolrServerException- if there is an error on the server
 
 - 
addpublic UpdateResponse add(String collection, Collection<SolrInputDocument> docs, int commitWithinMs) throws SolrServerException, IOException Adds a collection of documents, specifying max time before they become committed- Parameters:
- collection- the Solr collection to add documents to
- docs- the collection of documents
- commitWithinMs- max time (in ms) before a commit will happen
- Returns:
- an UpdateResponsefrom the server
- Throws:
- IOException- if there is a communication error with the server
- SolrServerException- if there is an error on the server
- Since:
- Solr 5.1
 
 - 
addpublic UpdateResponse add(Collection<SolrInputDocument> docs, int commitWithinMs) throws SolrServerException, IOException Adds a collection of documents, specifying max time before they become committed- Parameters:
- docs- the collection of documents
- commitWithinMs- max time (in ms) before a commit will happen
- Returns:
- an UpdateResponsefrom the server
- Throws:
- IOException- if there is a communication error with the server
- SolrServerException- if there is an error on the server
- Since:
- Solr 3.5
 
 - 
addpublic UpdateResponse add(String collection, SolrInputDocument doc) throws SolrServerException, IOException Adds a single document- Parameters:
- collection- the Solr collection to add the document to
- doc- the input document
- Returns:
- an UpdateResponsefrom the server
- Throws:
- IOException- if there is a communication error with the server
- SolrServerException- if there is an error on the server
 
 - 
addpublic UpdateResponse add(SolrInputDocument doc) throws SolrServerException, IOException Adds a single documentMany SolrClientimplementations have drastically slower indexing performance when documents are added individually. Document batching generally leads to better indexing performance and should be used whenever possible.- Parameters:
- doc- the input document
- Returns:
- an UpdateResponsefrom the server
- Throws:
- IOException- if there is a communication error with the server
- SolrServerException- if there is an error on the server
 
 - 
addpublic UpdateResponse add(String collection, SolrInputDocument doc, int commitWithinMs) throws SolrServerException, IOException Adds a single document specifying max time before it becomes committed- Parameters:
- collection- the Solr collection to add the document to
- doc- the input document
- commitWithinMs- max time (in ms) before a commit will happen
- Returns:
- an UpdateResponsefrom the server
- Throws:
- IOException- if there is a communication error with the server
- SolrServerException- if there is an error on the server
- Since:
- solr 5.1
 
 - 
addpublic UpdateResponse add(SolrInputDocument doc, int commitWithinMs) throws SolrServerException, IOException Adds a single document specifying max time before it becomes committed- Parameters:
- doc- the input document
- commitWithinMs- max time (in ms) before a commit will happen
- Returns:
- an UpdateResponsefrom the server
- Throws:
- IOException- if there is a communication error with the server
- SolrServerException- if there is an error on the server
- Since:
- solr 3.5
 
 - 
addpublic UpdateResponse add(String collection, Iterator<SolrInputDocument> docIterator) throws SolrServerException, IOException Adds the documents supplied by the given iterator.- Parameters:
- collection- the Solr collection to add the documents to
- docIterator- the iterator which returns SolrInputDocument instances
- Returns:
- an UpdateResponsefrom the server
- Throws:
- IOException- if there is a communication error with the server
- SolrServerException- if there is an error on the server
 
 - 
addpublic UpdateResponse add(Iterator<SolrInputDocument> docIterator) throws SolrServerException, IOException Adds the documents supplied by the given iterator.- Parameters:
- docIterator- the iterator which returns SolrInputDocument instances
- Returns:
- an UpdateResponsefrom the server
- Throws:
- IOException- if there is a communication error with the server
- SolrServerException- if there is an error on the server
 
 - 
addBeanpublic UpdateResponse addBean(String collection, Object obj) throws IOException, SolrServerException Adds a single beanThe bean is converted to a SolrInputDocumentby the client'sDocumentObjectBinderMany SolrClientimplementations have drastically slower indexing performance when documents are added individually. Document batching generally leads to better indexing performance and should be used whenever possible.- Parameters:
- collection- to Solr collection to add documents to
- obj- the input bean
- Returns:
- an UpdateResponsefrom the server
- Throws:
- IOException- if there is a communication error with the server
- SolrServerException- if there is an error on the server
 
 - 
addBeanpublic UpdateResponse addBean(Object obj) throws IOException, SolrServerException Adds a single beanThe bean is converted to a SolrInputDocumentby the client'sDocumentObjectBinder- Parameters:
- obj- the input bean
- Returns:
- an UpdateResponsefrom the server
- Throws:
- IOException- if there is a communication error with the server
- SolrServerException- if there is an error on the server
 
 - 
addBeanpublic UpdateResponse addBean(String collection, Object obj, int commitWithinMs) throws IOException, SolrServerException Adds a single bean specifying max time before it becomes committedThe bean is converted to a SolrInputDocumentby the client'sDocumentObjectBinder- Parameters:
- collection- to Solr collection to add documents to
- obj- the input bean
- Returns:
- an UpdateResponsefrom the server
- Throws:
- IOException- if there is a communication error with the server
- SolrServerException- if there is an error on the server
 
 - 
addBeanpublic UpdateResponse addBean(Object obj, int commitWithinMs) throws IOException, SolrServerException Adds a single bean specifying max time before it becomes committedThe bean is converted to a SolrInputDocumentby the client'sDocumentObjectBinder- Parameters:
- obj- the input bean
- Returns:
- an UpdateResponsefrom the server
- Throws:
- IOException- if there is a communication error with the server
- SolrServerException- if there is an error on the server
 
 - 
addBeanspublic UpdateResponse addBeans(String collection, Collection<?> beans) throws SolrServerException, IOException Adds a collection of beansThe beans are converted to SolrInputDocuments by the client'sDocumentObjectBinder- Parameters:
- collection- the Solr collection to add documents to
- beans- the collection of beans
- Returns:
- an UpdateResponsefrom the server
- Throws:
- IOException- if there is a communication error with the server
- SolrServerException- if there is an error on the server
 
 - 
addBeanspublic UpdateResponse addBeans(Collection<?> beans) throws SolrServerException, IOException Adds a collection of beansThe beans are converted to SolrInputDocuments by the client'sDocumentObjectBinder- Parameters:
- beans- the collection of beans
- Returns:
- an UpdateResponsefrom the server
- Throws:
- IOException- if there is a communication error with the server
- SolrServerException- if there is an error on the server
 
 - 
addBeanspublic UpdateResponse addBeans(String collection, Collection<?> beans, int commitWithinMs) throws SolrServerException, IOException Adds a collection of beans specifying max time before they become committedThe beans are converted to SolrInputDocuments by the client'sDocumentObjectBinder- Parameters:
- collection- the Solr collection to add documents to
- beans- the collection of beans
- commitWithinMs- max time (in ms) before a commit will happen
- Returns:
- an UpdateResponsefrom the server
- Throws:
- IOException- if there is a communication error with the server
- SolrServerException- if there is an error on the server
- Since:
- solr 5.1
- See Also:
- getBinder()
 
 - 
addBeanspublic UpdateResponse addBeans(Collection<?> beans, int commitWithinMs) throws SolrServerException, IOException Adds a collection of beans specifying max time before they become committedThe beans are converted to SolrInputDocuments by the client'sDocumentObjectBinder- Parameters:
- beans- the collection of beans
- commitWithinMs- max time (in ms) before a commit will happen
- Returns:
- an UpdateResponsefrom the server
- Throws:
- IOException- if there is a communication error with the server
- SolrServerException- if there is an error on the server
- Since:
- solr 3.5
- See Also:
- getBinder()
 
 - 
addBeanspublic UpdateResponse addBeans(String collection, Iterator<?> beanIterator) throws SolrServerException, IOException Adds the beans supplied by the given iterator.- Parameters:
- collection- the Solr collection to add the documents to
- beanIterator- the iterator which returns Beans
- Returns:
- an UpdateResponsefrom the server
- Throws:
- IOException- if there is a communication error with the server
- SolrServerException- if there is an error on the server
 
 - 
addBeanspublic UpdateResponse addBeans(Iterator<?> beanIterator) throws SolrServerException, IOException Adds the beans supplied by the given iterator.- Parameters:
- beanIterator- the iterator which returns Beans
- Returns:
- an UpdateResponsefrom the server
- Throws:
- IOException- if there is a communication error with the server
- SolrServerException- if there is an error on the server
 
 - 
commitpublic UpdateResponse commit(String collection) throws SolrServerException, IOException Performs an explicit commit, causing pending documents to be committed for indexingwaitFlush=true and waitSearcher=true to be inline with the defaults for plain HTTP access Be very careful when triggering commits from the client side. Commits are heavy operations and WILL impact Solr performance when executed too often or too close together. Instead, consider using 'commitWithin' when adding documents or rely on your core's/collection's 'autoCommit' settings. - Parameters:
- collection- the Solr collection to send the commit to
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
commitpublic UpdateResponse commit() throws SolrServerException, IOException Performs an explicit commit, causing pending documents to be committed for indexingwaitFlush=true and waitSearcher=true to be inline with the defaults for plain HTTP access Be very careful when triggering commits from the client side. Commits are heavy operations and WILL impact Solr performance when executed too often or too close together. Instead, consider using 'commitWithin' when adding documents or rely on your core's/collection's 'autoCommit' settings. - Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
commitpublic UpdateResponse commit(String collection, boolean waitFlush, boolean waitSearcher) throws SolrServerException, IOException Performs an explicit commit, causing pending documents to be committed for indexingBe very careful when triggering commits from the client side. Commits are heavy operations and WILL impact Solr performance when executed too often or too close together. Instead, consider using 'commitWithin' when adding documents or rely on your core's/collection's 'autoCommit' settings. - Parameters:
- collection- the Solr collection to send the commit to
- waitFlush- block until index changes are flushed to disk
- waitSearcher- block until a new searcher is opened and registered as the main query searcher, making the changes visible
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
commitpublic UpdateResponse commit(boolean waitFlush, boolean waitSearcher) throws SolrServerException, IOException Performs an explicit commit, causing pending documents to be committed for indexingBe very careful when triggering commits from the client side. Commits are heavy operations and WILL impact Solr performance when executed too often or too close together. Instead, consider using 'commitWithin' when adding documents or rely on your core's/collection's 'autoCommit' settings. - Parameters:
- waitFlush- block until index changes are flushed to disk
- waitSearcher- block until a new searcher is opened and registered as the main query searcher, making the changes visible
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
commitpublic UpdateResponse commit(String collection, boolean waitFlush, boolean waitSearcher, boolean softCommit) throws SolrServerException, IOException Performs an explicit commit, causing pending documents to be committed for indexingBe very careful when triggering commits from the client side. Commits are heavy operations and WILL impact Solr performance when executed too often or too close together. Instead, consider using 'commitWithin' when adding documents or rely on your core's/collection's 'autoCommit' settings. - Parameters:
- collection- the Solr collection to send the commit to
- waitFlush- block until index changes are flushed to disk
- waitSearcher- block until a new searcher is opened and registered as the main query searcher, making the changes visible
- softCommit- makes index changes visible while neither fsync-ing index files nor writing a new index descriptor
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
commitpublic UpdateResponse commit(boolean waitFlush, boolean waitSearcher, boolean softCommit) throws SolrServerException, IOException Performs an explicit commit, causing pending documents to be committed for indexingBe very careful when triggering commits from the client side. Commits are heavy operations and WILL impact Solr performance when executed too often or too close together. Instead, consider using 'commitWithin' when adding documents or rely on your core's/collection's 'autoCommit' settings. - Parameters:
- waitFlush- block until index changes are flushed to disk
- waitSearcher- block until a new searcher is opened and registered as the main query searcher, making the changes visible
- softCommit- makes index changes visible while neither fsync-ing index files nor writing a new index descriptor
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
optimizepublic UpdateResponse optimize(String collection) throws SolrServerException, IOException Performs an explicit optimize, causing a merge of all segments to one.waitFlush=true and waitSearcher=true to be inline with the defaults for plain HTTP access Note: In most cases it is not required to do explicit optimize - Parameters:
- collection- the Solr collection to send the optimize command to
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
optimizepublic UpdateResponse optimize() throws SolrServerException, IOException Performs an explicit optimize, causing a merge of all segments to one.waitFlush=true and waitSearcher=true to be inline with the defaults for plain HTTP access Note: In most cases it is not required to do explicit optimize - Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
optimizepublic UpdateResponse optimize(String collection, boolean waitFlush, boolean waitSearcher) throws SolrServerException, IOException Performs an explicit optimize, causing a merge of all segments to one.Note: In most cases it is not required to do explicit optimize - Parameters:
- collection- the Solr collection to send the optimize command to
- waitFlush- block until index changes are flushed to disk
- waitSearcher- block until a new searcher is opened and registered as the main query searcher, making the changes visible
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
optimizepublic UpdateResponse optimize(boolean waitFlush, boolean waitSearcher) throws SolrServerException, IOException Performs an explicit optimize, causing a merge of all segments to one.Note: In most cases it is not required to do explicit optimize - Parameters:
- waitFlush- block until index changes are flushed to disk
- waitSearcher- block until a new searcher is opened and registered as the main query searcher, making the changes visible
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
optimizepublic UpdateResponse optimize(String collection, boolean waitFlush, boolean waitSearcher, int maxSegments) throws SolrServerException, IOException Performs an explicit optimize, causing a merge of all segments to one.Note: In most cases it is not required to do explicit optimize - Parameters:
- collection- the Solr collection to send the optimize command to
- waitFlush- block until index changes are flushed to disk
- waitSearcher- block until a new searcher is opened and registered as the main query searcher, making the changes visible
- maxSegments- optimizes down to at most this number of segments
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
optimizepublic UpdateResponse optimize(boolean waitFlush, boolean waitSearcher, int maxSegments) throws SolrServerException, IOException Performs an explicit optimize, causing a merge of all segments to one.Note: In most cases it is not required to do explicit optimize - Parameters:
- waitFlush- block until index changes are flushed to disk
- waitSearcher- block until a new searcher is opened and registered as the main query searcher, making the changes visible
- maxSegments- optimizes down to at most this number of segments
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
rollbackpublic UpdateResponse rollback(String collection) throws SolrServerException, IOException Performs a rollback of all non-committed documents pending.Note that this is not a true rollback as in databases. Content you have previously added may have been committed due to autoCommit, buffer full, other client performing a commit etc. Also note that rollbacks reset changes made by all clients. Use this method carefully when multiple clients, or multithreaded clients are in use. - Parameters:
- collection- the Solr collection to send the rollback to
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
rollbackpublic UpdateResponse rollback() throws SolrServerException, IOException Performs a rollback of all non-committed documents pending.Note that this is not a true rollback as in databases. Content you have previously added may have been committed due to autoCommit, buffer full, other client performing a commit etc. Also note that rollbacks reset changes made by all clients. Use this method carefully when multiple clients, or multithreaded clients are in use. - Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
deleteByIdpublic UpdateResponse deleteById(String collection, String id) throws SolrServerException, IOException Deletes a single document by unique ID. Doesn't work for child/nested docs.- Parameters:
- collection- the Solr collection to delete the document from
- id- the ID of the document to delete
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
deleteByIdpublic UpdateResponse deleteById(String id) throws SolrServerException, IOException Deletes a single document by unique ID. Doesn't work for child/nested docs.- Parameters:
- id- the ID of the document to delete
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
deleteByIdpublic UpdateResponse deleteById(String collection, String id, int commitWithinMs) throws SolrServerException, IOException Deletes a single document by unique ID, specifying max time before commit. Doesn't work for child/nested docs.- Parameters:
- collection- the Solr collection to delete the document from
- id- the ID of the document to delete
- commitWithinMs- max time (in ms) before a commit will happen
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
- Since:
- 5.1
 
 - 
deleteByIdpublic UpdateResponse deleteById(String id, int commitWithinMs) throws SolrServerException, IOException Deletes a single document by unique ID, specifying max time before commit. Doesn't work for child/nested docs.- Parameters:
- id- the ID of the document to delete
- commitWithinMs- max time (in ms) before a commit will happen
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
- Since:
- 3.6
 
 - 
deleteByIdpublic UpdateResponse deleteById(String collection, List<String> ids) throws SolrServerException, IOException Deletes a list of documents by unique ID. Doesn't work for child/nested docs.- Parameters:
- collection- the Solr collection to delete the documents from
- ids- the list of document IDs to delete; must be non-null and contain elements
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
deleteByIdpublic UpdateResponse deleteById(List<String> ids) throws SolrServerException, IOException Deletes a list of documents by unique ID. Doesn't work for child/nested docs.- Parameters:
- ids- the list of document IDs to delete; must be non-null and contain elements
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
deleteByIdpublic UpdateResponse deleteById(String collection, List<String> ids, int commitWithinMs) throws SolrServerException, IOException Deletes a list of documents by unique ID, specifying max time before commit. Doesn't work for child/nested docs.- Parameters:
- collection- the Solr collection to delete the documents from
- ids- the list of document IDs to delete; must be non-null and contain elements
- commitWithinMs- max time (in ms) before a commit will happen
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
- Since:
- 5.1
 
 - 
deleteByIdpublic UpdateResponse deleteById(List<String> ids, int commitWithinMs) throws SolrServerException, IOException Deletes a list of documents by unique ID, specifying max time before commit. Doesn't work for child/nested docs.- Parameters:
- ids- the list of document IDs to delete
- commitWithinMs- max time (in ms) before a commit will happen
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
- Since:
- 3.6
 
 - 
deleteByQuerypublic UpdateResponse deleteByQuery(String collection, String query) throws SolrServerException, IOException Deletes documents from the index based on a query- Parameters:
- collection- the Solr collection to delete the documents from
- query- the query expressing what documents to delete
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
deleteByQuerypublic UpdateResponse deleteByQuery(String query) throws SolrServerException, IOException Deletes documents from the index based on a query- Parameters:
- query- the query expressing what documents to delete
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
deleteByQuerypublic UpdateResponse deleteByQuery(String collection, String query, int commitWithinMs) throws SolrServerException, IOException Deletes documents from the index based on a query, specifying max time before commit- Parameters:
- collection- the Solr collection to delete the documents from
- query- the query expressing what documents to delete
- commitWithinMs- max time (in ms) before a commit will happen
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
- Since:
- 5.1
 
 - 
deleteByQuerypublic UpdateResponse deleteByQuery(String query, int commitWithinMs) throws SolrServerException, IOException Deletes documents from the index based on a query, specifying max time before commit- Parameters:
- query- the query expressing what documents to delete
- commitWithinMs- max time (in ms) before a commit will happen
- Returns:
- an UpdateResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
- Since:
- 3.6
 
 - 
pingpublic SolrPingResponse ping(String collection) throws SolrServerException, IOException Issues a ping request to check if the collection's replicas are alive- Parameters:
- collection- collection to ping
- Returns:
- a SolrPingResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
pingpublic SolrPingResponse ping() throws SolrServerException, IOException Issues a ping request to check if the server is alive- Returns:
- a SolrPingResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
querypublic QueryResponse query(String collection, SolrParams params) throws SolrServerException, IOException Performs a query to the Solr server- Parameters:
- collection- the Solr collection to query
- params- an object holding all key/value parameters to send along the request
- Returns:
- a QueryResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
querypublic QueryResponse query(SolrParams params) throws SolrServerException, IOException Performs a query to the Solr server- Parameters:
- params- an object holding all key/value parameters to send along the request
- Returns:
- a QueryResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
querypublic QueryResponse query(String collection, SolrParams params, SolrRequest.METHOD method) throws SolrServerException, IOException Performs a query to the Solr server- Parameters:
- collection- the Solr collection to query
- params- an object holding all key/value parameters to send along the request
- method- specifies the HTTP method to use for the request, such as GET or POST
- Returns:
- a QueryResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
querypublic QueryResponse query(SolrParams params, SolrRequest.METHOD method) throws SolrServerException, IOException Performs a query to the Solr server- Parameters:
- params- an object holding all key/value parameters to send along the request
- method- specifies the HTTP method to use for the request, such as GET or POST
- Returns:
- a QueryResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
queryAndStreamResponsepublic QueryResponse queryAndStreamResponse(String collection, SolrParams params, StreamingResponseCallback callback) throws SolrServerException, IOException Query solr, and stream the results. Unlike the standard query, this will send events for each Document rather than add them to the QueryResponse.Although this function returns a 'QueryResponse' it should be used with care since it excludes anything that was passed to callback. Also note that future version may pass even more info to the callback and may not return the results in the QueryResponse. - Parameters:
- collection- the Solr collection to query
- params- an object holding all key/value parameters to send along the request
- callback- the callback to stream results to
- Returns:
- a QueryResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
- Since:
- solr 5.1
 
 - 
queryAndStreamResponsepublic QueryResponse queryAndStreamResponse(String collection, SolrParams params, FastStreamingDocsCallback callback) throws SolrServerException, IOException - Throws:
- SolrServerException
- IOException
 
 - 
queryAndStreamResponsepublic QueryResponse queryAndStreamResponse(SolrParams params, StreamingResponseCallback callback) throws SolrServerException, IOException Query solr, and stream the results. Unlike the standard query, this will send events for each Document rather than add them to the QueryResponse.Although this function returns a 'QueryResponse' it should be used with care since it excludes anything that was passed to callback. Also note that future version may pass even more info to the callback and may not return the results in the QueryResponse. - Parameters:
- params- an object holding all key/value parameters to send along the request
- callback- the callback to stream results to
- Returns:
- a QueryResponsecontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
- Since:
- solr 4.0
 
 - 
getByIdpublic SolrDocument getById(String collection, String id) throws SolrServerException, IOException Retrieves the SolrDocument associated with the given identifier.- Parameters:
- collection- the Solr collection to query
- id- the id
- Returns:
- retrieved SolrDocument, or null if no document is found.
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
getByIdpublic SolrDocument getById(String id) throws SolrServerException, IOException Retrieves the SolrDocument associated with the given identifier.- Parameters:
- id- the id
- Returns:
- retrieved SolrDocument, or null if no document is found.
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
getByIdpublic SolrDocument getById(String collection, String id, SolrParams params) throws SolrServerException, IOException Retrieves the SolrDocument associated with the given identifier and uses the SolrParams to execute the request.- Parameters:
- collection- the Solr collection to query
- id- the id
- params- additional parameters to add to the query
- Returns:
- retrieved SolrDocument, or null if no document is found.
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
getByIdpublic SolrDocument getById(String id, SolrParams params) throws SolrServerException, IOException Retrieves the SolrDocument associated with the given identifier and uses the SolrParams to execute the request.- Parameters:
- id- the id
- params- additional parameters to add to the query
- Returns:
- retrieved SolrDocument, or null if no document is found.
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
getByIdpublic SolrDocumentList getById(String collection, Collection<String> ids) throws SolrServerException, IOException Retrieves the SolrDocuments associated with the given identifiers.If a document was not found, it will not be added to the SolrDocumentList. - Parameters:
- collection- the Solr collection to query
- ids- the ids
- Returns:
- a SolrDocumentList, or null if no documents were found
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
getByIdpublic SolrDocumentList getById(Collection<String> ids) throws SolrServerException, IOException Retrieves the SolrDocuments associated with the given identifiers.If a document was not found, it will not be added to the SolrDocumentList. - Parameters:
- ids- the ids
- Returns:
- a SolrDocumentList, or null if no documents were found
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
getByIdpublic SolrDocumentList getById(String collection, Collection<String> ids, SolrParams params) throws SolrServerException, IOException Retrieves the SolrDocuments associated with the given identifiers and uses the SolrParams to execute the request.If a document was not found, it will not be added to the SolrDocumentList. - Parameters:
- collection- the Solr collection to query
- ids- the ids
- params- additional parameters to add to the query
- Returns:
- a SolrDocumentList, or null if no documents were found
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
getByIdpublic SolrDocumentList getById(Collection<String> ids, SolrParams params) throws SolrServerException, IOException Retrieves the SolrDocuments associated with the given identifiers and uses the SolrParams to execute the request.If a document was not found, it will not be added to the SolrDocumentList. - Parameters:
- ids- the ids
- params- additional parameters to add to the query
- Returns:
- a SolrDocumentList, or null if no documents were found
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
requestpublic abstract NamedList<Object> request(SolrRequest<?> request, String collection) throws SolrServerException, IOException Execute a request against a Solr server for a given collection- Parameters:
- request- the request to execute
- collection- the collection to execute the request against
- Returns:
- a NamedListcontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
requestpublic final NamedList<Object> request(SolrRequest<?> request) throws SolrServerException, IOException Execute a request against a Solr server using the default collection- Parameters:
- request- the request to execute
- Returns:
- a NamedListcontaining the response from the server
- Throws:
- IOException- If there is a low-level I/O error.
- SolrServerException- if there is an error on the server
 
 - 
getBinderpublic DocumentObjectBinder getBinder() Get theDocumentObjectBinderfor this client.- Returns:
- a DocumentObjectBinder
- See Also:
- addBean(java.lang.String, java.lang.Object),- addBeans(java.lang.String, java.util.Collection<?>)
 
 - 
getContextpublic SolrRequest.SolrClientContext getContext() This method defines the context in which this Solr client is being used (e.g. for internal communication between Solr nodes or as an external client). The default value isSolrClientContext#Client
 - 
getDefaultCollectionpublic String getDefaultCollection() Gets the collection used by default for collection or core-based requestsIf no value is specified at client-creation time, this method will return null. 
 
- 
 
-