Need a special offer?Find out if your project fits.
+
API reference
  • API Reference for older versions
  • Table of contents

    /select request for the flat table

    [starting from version: 2.8]

    A request for data.

    Request

    {
      "type": string,
      "index": string,
      "query": {
        "fields": FieldObject[],
        "filter": FilterObject[] | FilterGroupObject,
        "aggs": {
          "values": ValueObject[]
        }
      },
      "page": number
    }
    Parameter/Type Description
    type
    String
    The type of the request. In this case, it is "select".
    index
    String
    The dataset identifier.
    query
    Object
    A query object.
    query.fields
    FieldObject[]
    An array of fields (columns) to include in the response.
    query.filter
    FilterObject[] | FilterGroupObject
    optional Query filters. The part of a query that specifies which filters should be applied to the data.
    If the server does not support multilevel hierarchies (i.e., the filters.advanced property is set to false), the filter's structure is an array of FilterObjects.
    If multilevel hierarchies are supported, the filter can be:
    query.aggs
    Object
    optional Query column totals.
    query.aggs.values
    ValueObject[]
    Columns to aggregate totals for.
    Fields with at least one supported aggregation defined in the schema can be selected for this part of the query.
    page
    Number
    The page number. It can be used to load data by parts. If the response contains the pageTotal parameter, additional requests will be performed to load the remaining pages. Starts from 0.

    Response

    {
      "fields": FieldObject[],
      "hits": [][],
      "aggs": AggregatedDataObject[],
      "page": number,
      "pageTotal": number
    }
    Parameter/Type Description
    fields
    FieldObject[]
    Fields (columns) included in the response. Only the uniqueName property of the FieldObject should be specified in the response.
    hits
    Array of arrays
    A two-dimensional array with data. Each subarray should contain ordered values.
    aggs
    AggregatedDataObject[]
    optional Column totals.
    page
    Number
    optional The current page number. Should start from 0.
    pageTotal
    Number
    optional The total number of pages. It can be used to load members by parts.

    Example

    Request:

    {
      "index": "dataset-123",
      "type": "select",
      "query": {
        "fields": [
          {
            "uniqueName": "Country"
          },
          {
            "uniqueName": "City"
          },
          {
            "uniqueName": "Price"
          },
          {
            "uniqueName": "Quantity"
          }
        ],
        "aggs": {
          "values": [
            {
              "func": "sum", 
              "field": {
                "uniqueName": "Price"
              }
            }, 
            {
              "func": "sum", 
              "field": {
                "uniqueName": "Quantity"
              }
            }
          ]
        }
      },
      "page": 0
    } 

    Response:

    {
      "fields": [
        { "uniqueName": "Country" },
        { "uniqueName": "City" },
        { "uniqueName": "Price" },
        { "uniqueName": "Quantity" }
      ],
      "hits": [
          ["Canada", "Toronto", 53, 2],
          ["Canada", "Montreal", 100, 1]
      ],
      "aggs": [{
        "values": {
          "price": {
             "sum": 153
          },
          "quantity": {
             "sum": 3
          }
        }
      }]
    }

    See also

    /handshake request
    /fields request
    /members request
    /select request for pivot table
    /select request for drill-through view