In addition to being able to use Managed Search APIs for managing clusters and collections, you can use Solr APIs for operations such as indexing documents and searching.
How to use Solr APIs
Use Solr APIs from Managed Search as follows:
1. Get an OAuth2 access token for Solr APIs
Get an OAuth2 access token for Solr APIs. You do this in the same way as you do for an OAuth2 access token for Managed Search APIs, but specify a different scope.
2. Develop a client app
You need some means of submitting API requests to Solr. You can develop a client app or use an existing app:
Note
|
The client app that we use in our examples is curl, a command line tool that can send HTTP requests and receive responses (as well as other things). |
3. Submit requests
Use Solr HTTP REST APIs to submit Solr requests.
-
Include the OAuth2 access token for Solr APIs in the
Authorize
header. -
Specify the Solr API endpoints for Managed Search.
4. Use information from the responses
What you do with the information you get back from API requests is up to you.
Examples
Post a single document to a collection
curl "https://pg01.us-west1.cloud.lucidworks.com/lucidworks/jeff-1/solr/test-collection/update/json/docs?commit=true" -H "Authorization: Bearer accessTokenSolr" -H "Content-type: application/json" -d '{"id":"1", "field1": "value1"}'
The POST method is implicit.
Post multiple documents to a collection
curl "https://pg01.us-west1.cloud.lucidworks.com/lucidworks/jeff-1/solr/test-collection/update/json/docs?commit=true" -H "Authorization: Bearer accessTokenSolr" -H "Content-type: application/json" -d '[{"id":"1", "field1": "value1"},{"id":"2", "field1": "value2"},{"id":"3", "field1": "value3"}]'
The POST method is implicit.
Modify a document
curl "https://pg01.us-west1.cloud.lucidworks.com/lucidworks/jeff-1/solr/test-collection/update/json/docs?commit=true" -H "Authorization: Bearer accessTokenSolr" -H "Content-type: application/json" -d '{"id":"1", "field1": "value7"}'
The POST method is implicit.
Search for documents
curl "https://pg01.us-west1.cloud.lucidworks.com/lucidworks/jeff-1/solr/test-collection/select?q=*:*" -H "Authorization: Bearer accessTokenSolr"
The GET method is implicit.