Skip to main content
POST
/
v1
Multi query items
curl --request POST \
  --url https://query.enterspeed.com/v1 \
  --header 'Content-Length: <content-length>' \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: <x-api-key>' \
  --data '
[
  {
    "index": "products",
    "name": "productData",
    "filters": {
      "and": [
        {
          "field": "title",
          "operator": "contains",
          "value": "*hoodie*",
          "caseInsensitive": true
        },
        {
          "or": [
            {
              "field": "isInStock",
              "operator": "equals",
              "value": true
            },
            {
              "field": "allowPreorder",
              "operator": "equals",
              "value": true
            }
          ]
        }
      ]
    },
    "aliases": [
      "productTile"
    ],
    "facets": [
      {
        "name": "Categories",
        "field": "category",
        "size": 20
      },
      {
        "name": "In Stock",
        "field": "isInStock"
      }
    ],
    "sort": [
      {
        "field": "price",
        "order": "asc"
      }
    ],
    "pagination": {
      "page": 0,
      "pageSize": 20
    }
  },
  {
    "index": "products",
    "name": "facets",
    "facets": [
      {
        "name": "Categories",
        "field": "category",
        "size": 20
      },
      {
        "name": "In Stock",
        "field": "isInStock"
      }
    ],
    "pagination": {
      "pageSize": 0
    }
  }
]
'
{}

Headers

X-Api-Key
string
required

Api key to validate your environment.

Example:

"environment-1637c4d0-e878-4738-b866-152106a4f88c"

Content-Length
number
required

The length of the message body, in bytes (this header is automatically added by most clients).

Body

application/json

The query consists of a list of query objects, on the format just like when quering items in a single index, so refer to this section when looking into filters, sorting, pagination etc.

The only thing that differs with these query objects, is an addition of an index and a name field, so you per query can define which index you want to perform the query against and also name the individual query. This means that this service can perform multiple queries on the same index, or perform queries on multiple indicies in one request, and also give you the ability to name queries for easier identification of the resulting result sets.

Note

The request payload can at most take 5 queries in one request.

Example:
[
{
"index": "products",
"name": "productData",
"filters": {
"and": [
{
"field": "title",
"operator": "contains",
"value": "*hoodie*",
"caseInsensitive": true
},
{
"or": [
{
"field": "isInStock",
"operator": "equals",
"value": true
},
{
"field": "allowPreorder",
"operator": "equals",
"value": true
}
]
}
]
},
"aliases": ["productTile"],
"facets": [
{
"name": "Categories",
"field": "category",
"size": 20
},
{ "name": "In Stock", "field": "isInStock" }
],
"sort": [{ "field": "price", "order": "asc" }],
"pagination": { "page": 0, "pageSize": 20 }
},
{
"index": "products",
"name": "facets",
"facets": [
{
"name": "Categories",
"field": "category",
"size": 20
},
{ "name": "In Stock", "field": "isInStock" }
],
"pagination": { "pageSize": 0 }
}
]

Response

When one or more queries results in a valid response a 200 response is returned. If any of the other requested queries fails, either due to validation errors or other issues, the error message will be returned as part of the response.

The response is of type object.