StediDOCS
GuidesAPI Reference
This product is in Developer Preview

Search

Search is designed to work intuitively, the same way as any browser or file search.

Using Search in Terminal

Full text search is supported across indexed documents. A document in search is any JSON object that has been written to an index. Complex search queries using boolean logic are not currently supported.

Using Search programmatically

Create an index

Request
  curl --request POST \
    --url 'https://prod.search.stedi.com/index/'
    --data '{"name": "example_index_name"}' \
    --header 'Accept: application/json' \
    --header 'Content-Type: application/json'
Response
{
  "tenant": {
    "custom:stedi:organizationId": "ORGANIZATION_ID"
  },
  "name": "example_index_name",
  "state": "created"
}

Write data an index

You can write documents to an index and specify a custom "_id" field. This field can be used to "update" the document with different data on subsequent requests. If the "_id" field is specified in the request and a document with a matching "_id" value has already been indexed the document will be overwritten by the most recent request.

Request
  curl --request POST \
    --url 'https://prod.search.stedi.com/index/{example_index_name}/batch_write'
    --data '{"message": "Hello World", "_id": "custom_document_id"}' \
    --header 'Accept: application/json' \
    --header 'Content-Type: application/json'
Response
{}

Request using the same document ID but a different document body
Note this request will overwrite the document indexed in the previous call.

  curl --request POST \
    --url 'https://prod.search.stedi.com/index/{example_index_name}/batch_write'
    --data '{"message": "Hola Mundo", "_id": "custom_document_id"}' \
    --header 'Accept: application/json' \
    --header 'Content-Type: application/json'
Response
{}

Query an index

Request
  curl --request POST \
    --url 'https://prod.search.stedi.com/index/{example_index_name}/query'
    --data '{"query": "hello world"}' \
    --header 'Accept: application/json' \
    --header 'Content-Type: application/json'
Response
{
  "totalHits": 1,
  "hits": [
    {
      "fields": {},
      "highlights": {
        "field1": "<b>Hello</b> <b>World</b>, how do you do?"
      }
    }
  ],
  "query": "hello world"
}

List all indexes

Request
  curl --request GET \
    --url 'https://prod.search.stedi.com/index/'
    --header 'Accept: application/json' \
    --header 'Content-Type: application/json'
Response
[
  {
    "tenant": {
      "custom:stedi:organizationId": "ORGANIZATION_ID"
    },
    "name": "example_index_name",
    "state": "created"
  },
  {
    "tenant": {
      "custom:stedi:organizationId": "ORGANIZATION_ID"
    },
    "name": "example_index_name2",
    "state": "created"
  }
]