Ingest API


The SearchStax Site Search solution’s Ingest API lets you update Solr documents in your Site Search project..

The Search Endpoint (/emselect) and Suggestion Endpoint (/emsuggest) for your Search App is available within your Apps Management page as shown below. They use the “Read-Only” API credentials.

The Ingest endpoint is the /update endpoint and uses the “Read-Write” Search API credentials

  

Contents of this page:

  

Indexing JSON Documents

For indexing a single JSON document, pass the JSON document to the /update endpoint as shown below:

For apps using Token Authentication:

curl -H "Authorization: Token b70dacf3956e6e148393fbfREDACTED" -X POST -H 'Content-type:application/json' --data-binary '{"id":"1"}' "https://searchcloud-2-us-east-1.searchstax.com/12345/custom-1234/update?commit=true"

For app using Basic Authentication:

curl -X POST -H 'Content-Type: application/json' 'https://ss123456-cvrfzabx-us-east-1-aws.searchstax.com/solr/ss123456-SearchStudioCorpSite/update/json/docs' --user app40-admin:REDACTEDPWD --data-binary '
{
  "id": "1",
  "title": "Doc 1"
}'

Adding multiple documents can be done by passing an array of JSON objects to the /update endpoint as shown below

curl -H "Authorization: Token b70dacf3956e6e148393fbfREDACTED" -X POST -H 'Content-type:application/json' --data-binary '[{"id":"1","title_t":"Test Title","description_t":"Testing","group_s":"Token"}]' "https://searchcloud-2-us-east-1.searchstax.com/12345/custom-1234/update?commit=true"
curl -X POST -H 'Content-Type: application/json' 'https://ss123456-cvrfzabx-us-east-1-aws.searchstax.com/solr/ss123456-SearchStudioCorpSite/update' --user app40-admin:REDACTEDPWD --data-binary '
[
  {
    "id": "1",
    "title": "Doc 1"
  },
  {
    "id": "2",
    "title": "Doc 2"
  }
]'

If the data is in a JSON file and contains an array of JSON objects, you can make a call to the /update endpoint as shown below

curl -H "Authorization: Token b70dacf3956e6e148393fbfREDACTED" -X POST -H 'Content-type:application/json' --data-binary @example.json "https://searchcloud-2-us-east-1.searchstax.com/12345/custom-1234/update?commit=true"
curl -X POST -H 'Content-Type: application/json' 'https://ss123456-cvrfzabx-us-east-1-aws.searchstax.com/solr/ss123456-SearchStudioCorpSite/update' --user app40-admin:REDACTEDPWD --data-binary @example.json -H 'Content-type:application/json'
  

Indexing XML Documents

To index XML documents, you can send one or multiple <add> tags to the \update request as shown below:

For apps using Token Authentication:

curl -H "Authorization: Token b70dacf3956e6e148393fbfREDACTED" -X POST -H 'Content-type:text/xml' --data-binary '<add><doc><field name="id">id1</field><field name="title">Document1</field><field name="text">This is the first document</field></doc></add>' "https://searchcloud-2-us-east-1.searchstax.com/12345/custom-1234/update?commit=true"

For app using Basic Authentication:

curl -X POST -H 'Content-Type: text/xml' 'https://ss123456-cvrfzabx-us-east-1-aws.searchstax.com/solr/ss123456-SearchStudioCorpSite/update' --user app40-admin:REDACTEDPWD --data-binary '
<add>
  <doc>
    <field name="id">id1</field>
    <field name="title">Document1</field>
    <field name="text">This is the first document</field>
   </doc>
</add>'
  • The <add> element introduces one more documents to be added. This can be substituted by <update> to update the document
  • The <doc> element introduces the fields making up a document.
  • The <field> element presents the content for a specific field.
  

Deleting Documents

Documents can be deleted from the index in two ways.

  • “Delete by ID” deletes the document with the specified ID
  • “Delete by Query” deletes all documents matching a specified query

Example:

For apps using Token Authentication:

curl -H "Authorization: Token b70dacf3956e6e148393fbfREDACTED" -X POST -H 'Content-type:text/xml' --data-binary '<delete><id>0002166313</id><id>0031745983</id><query>title:title1</query><query>text:redact</query></delete>' "https://searchcloud-2-us-east-1.searchstax.com/12345/custom-1234/update"
curl -H "Authorization: Token b70dacf3956e6e148393fbfREDACTED" -X POST -H 'Content-type:text/xml' --data-binary '{"delete":{"id":"0002166313"},"delete":{"id":"0031745983"},"delete":{"query":"title:title1"},"delete":{"query":"text:redact"}}' "https://searchcloud-2-us-east-1.searchstax.com/12345/custom-1234/update"

For app using Basic Authentication:

curl -X POST -H 'Content-Type: text/xml' 'https://ss123456-cvrfzabx-us-east-1-aws.searchstax.com/solr/ss123456-SearchStudioCorpSite/update' --user app40-admin:REDACTEDPWD --data-binary '
<delete>
  <id>0002166313</id>
  <id>0031745983</id>
  <query>title:title1</query>
  <query>text:redact</query>
</delete>'
curl -X POST -H 'Content-Type: application/json' 'https://ss123456-cvrfzabx-us-east-1-aws.searchstax.com/solr/ss123456-SearchStudioCorpSite/update' --user app40-admin:REDACTEDPWD --data-binary '
{
  "delete": {"id": "0002166313"},
  "delete": {"id": "0031745983"},
  "delete": {"query": "title:title1"},
  "delete": {"query": "text:redact"}
}'
  

API Limits

  • All update requests should have a max size of 2048KB.

Questions?

Do not hesitate to contact the SearchStax Support Desk.