Search

The search endpoint enables querying of your indices to fetch Documents. This is accomplished by dispatching a search request to the endpoint, which in turn returns a set of documents matching the provided query.

Search results can be fine-tuned using filters to narrow down the results based on specific criteria. For instance, filters can be used to include only those documents that possess a certain attribute or satisfy a certain condition.

Als the search results can be ordered based on their score or any other attribute. The score represents the degree of match between each document and the search query. Sorting the results ensures that the most pertinent documents are returned at the top.


Action Attributes

  • Name
    query
    Type
    string
    Description

    The search query string.

    This is the term or phrase you're searching for within the documents.

  • Name
    page
    Type
    integer
    Description

    The requested page number for pagination.

    This allows you to navigate through the search results page by page.

  • Name
    per_page
    Type
    integer
    Description

    The number of search results to display per page. Defaults to settings set in your dashboard. Maximum value is 1000. If a value greater than 1000 is passed, it will be treated as 1000.

  • Name
    facets
    Type
    string
    Description

    A string representing the facets requested. Facets are categories used to classify search results.

    The facets string is a space-separated list of attributes that you want to use for categorizing the search results.

    Example: "category type".

  • Name
    filter
    Type
    string
    Description

    The filters requested.

    Filters allow you to narrow down search results based on specific criteria.

    For more information on filter syntax, visit Filter syntax

  • Name
    sort
    Type
    string
    Description

    The sort order for the results. This determines the order in which search results are displayed.

    For more information on sort syntax, visit Sort syntax

The search body

{
  "query": "or",
  "sort": "_score",
  "filters": "type:'planet'",
  "facets": "category type",
  "page": 1,
  "per_page": 10
}

POST/v1/search/{index-name}

Endpoint

This endpoint allows you to run batch actions.

Parameters

  • Name
    query
    Type
    optional
    Description

    The search query string.

  • Name
    page
    Type
    optional
    Description

    The page number for the search results.

  • Name
    per_page
    Type
    optional
    Description

    The number of search results per page.

  • Name
    facets
    Type
    optional
    Description

    The facets requested for categorizing search results.

  • Name
    filter
    Type
    optional
    Description

    The filters applied to narrow down search results.

  • Name
    sort
    Type
    optional
    Description

    The sort order for the search results.

Security

  • Name
    search
    Type
    Search Key
    Description

    This endpoint can be accessed with a search API key.

  • Name
    admin
    Type
    Admin Key
    Description

    This endpoint can be accessed with either a admin API key.

Returns

Retuns a JSON object with the following attributes:

  • Name
    hits
    Type
    object
    Description

    Contains the search results.

  • Name
    processing_time_ms
    Type
    integer
    Description

    The time it took to process the request, in milliseconds.

  • Name
    total
    Type
    integer
    Description

    The total number of search results.

  • Name
    per_page
    Type
    integer
    Description

    The number of search results per page.

  • Name
    page
    Type
    integer
    Description

    The current page of search results.

  • Name
    query
    Type
    string
    Description

    The query string used for the search.

  • Name
    autocomplete
    Type
    array
    Description

    An array of autocomplete suggestions.

  • Name
    params
    Type
    object
    Description

    The parameters used for the search.

  • Name
    index
    Type
    string
    Description

    The index used for the search.

  • Name
    facets
    Type
    object
    Description

    The requested facet values.

  • Name
    sort
    Type
    string
    Description

    The sort order used for the search.

Request

POST
/v1/search/{index-name}
  curl -X POST https://sdfzzrn1amg3tbuxb.sigmie.app/v1/search/cosmic-realms \
    -H "Content-Type: application/json" \
    -H "X-Sigmie-API-Key: ${api_key}" \
    -H "X-Sigmie-Application: ${application_id}" \
    -d '{
          "query": "or",
          "page": "1",
          "per_page": "10",
          "sort": "_score"
        }'

Response

200
Ok
{
  "hits": {
    "Ont8qIIBrbFU6hq5wjQx": {
      "_id": "Ont8qIIBrbFU6hq5wjQx",
      "_score": 8.923651,
      "name": "Orion Nebula",
      "description": "A diffuse nebula located in the constellation of Orion, known for its star-forming activity.",
      "type": "Nebula",
      "age": "Approximately 1-3 million years",
      "size": "Approximately 24 light-years in diameter",
      "tags": ["astronomy", "space", "stellar nursery"]
    }
    // ...
  },
  "processing_time_ms": 5,
  "total": 30437304319,
  "per_page": 10,
  "page": 1,
  "query": "or",
  "autocomplete": [
    "orion nebula",
    "origin of the universe",
    "orbital dynamics",
    "organic matter in space",
    "orbiting satellites",
    "order of celestial bodies"
  ],
  "params": "",
  "index": "cosmic-realms",
  "filters": "",
  "facets": {},
  "sort": "_score"
}