# Get queries summary for multiple indices

- Operation ID: `GetQueriesSummaryMultipleIndices`
- HTTP method: `GET`
- Path: `/search/v2/indices/stats/queries/summary`
- [Human-readable API reference](https://hub.synerise.com/api-reference/ai-suite#operation/GetQueriesSummaryMultipleIndices)

## Self-contained OpenAPI method

The fenced document below contains this method's documentation and all of its local references. It is self-contained; no category or master specification fetch is required.

```yaml
openapi: 3.0.0
info:
  title: Synerise Public API
  version: 1.9.1
paths:
  /search/v2/indices/stats/queries/summary:
    get:
      summary: Get queries summary for multiple indices
      description: |
        Retrieves the statistics of all queries or a single query defined in the request for multiple indices.

        ---

        **API consumers:** <a href="/api-reference/authorization?tag=Authorization&amp;operationId=profileLogin" target="_blank" rel="noopener">Workspace (Business Profile)</a>, <a href="/api-reference/authorization?tag=Authorization&amp;operationId=userLogin" target="_blank" rel="noopener">Synerise User</a>

        **API key permission required:** `AI_STATS_READ`

        **User role permission required:** `assets_search: read`
      operationId: GetQueriesSummaryMultipleIndices
      tags:
        - Search Stats
      security:
        - JWT: []
      parameters:
        - name: indexId
          in: query
          required: true
          description: List of indices ids for which the stats are requested.
          schema:
            type: array
            items:
              type: string
        - name: dateFrom
          in: query
          required: false
          description: |
            Upper bound of the interval for which the statistics will be retrieved.  
            Must be provided with `to`, otherwise the filter is treated as unspecified.  
            If not specified, the interval is last 7 days.
          schema:
            type: string
            format: date
        - name: dateTo
          in: query
          required: false
          description: |
            Lower bound of the interval for which the statistics will be retrieved.
            If not specified, the interval is last 7 days.
          schema:
            type: string
            format: date
        - name: query
          in: query
          required: false
          description: Query for which stats will be returned. If not provided, the results are returned for the most popular queries.
          schema:
            type: string
        - name: searchType
          in: query
          required: false
          description: Search type for which stats will be retrieved.
          schema:
            type: string
            default: all
            enum:
              - fullTextSearch
              - autocomplete
              - listing
              - visual
              - all
        - name: groupBy
          in: query
          required: false
          description: Attribute for which retrieved stats will be grouped.
          schema:
            type: string
            enum:
              - date
      responses:
        "200":
          description: Statistics returned
          content:
            application/json:
              schema:
                type: object
                description: |
                  Response envelope for `GetQueriesSummaryMultipleIndices`. The `data`
                  field carries an array of per-index query stats summaries, one entry
                  per requested search index.
                required:
                  - data
                properties:
                  data:
                    type: array
                    description: Queries statistics for multiple indices
                    items:
                      type: object
                      properties:
                        indexId:
                          type: string
                          description: ID of the index for which the stats are requested
                          example: 4add1a1fa877c1651906bb22c9dfd37a1618852272
                        stats:
                          type: object
                          description: Queries statistics
                          properties:
                            averageClickPosition:
                              type: number
                              format: float
                              description: The average position of the clicked item on the list of results.
                            averageOrderValue:
                              type: number
                              format: float
                              description: The average value of orders resulting from the search.
                            clickThroughRate:
                              type: number
                              format: float
                              description: CTR of the search.
                            conversionRate:
                              type: number
                              format: float
                              description: Conversion rate of the search.
                            conversions:
                              type: integer
                              description: The number of successful conversions.
                            noResultsCount:
                              type: integer
                              description: The number of searches which returned no results.
                            revenue:
                              type: number
                              format: float
                              description: Revenue generated from the search.
                            totalClicks:
                              type: integer
                              description: The number of times a result was clicked.
                            totalCount:
                              type: integer
                              description: The number of times the search was performed.
                            totalSuggestionsUsed:
                              type: integer
                              description: The number of times a user accepted a suggestion.
        "500":
          description: Service error
          content:
            application/json:
              schema:
                type: object
                properties:
                  httpStatus:
                    type: integer
                    example: 500
                    description: HTTP status of the error.
                  errorCode:
                    type: integer
                    description: Status code. See [error reference](https://developers.synerise.com/errors.html).
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the error occurred.
                  message:
                    type: string
                    description: Description of the problem.
                  traceId:
                    type: string
                    description: Trace ID for debugging.
                  help:
                    type: string
                    description: Currently unused.
        4xx:
          description: Incorrect request
          content:
            application/json:
              schema:
                type: object
                properties:
                  httpStatus:
                    type: integer
                    example: 500
                    description: HTTP status of the error.
                  errorCode:
                    type: integer
                    description: Status code. See [error reference](https://developers.synerise.com/errors.html).
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the error occurred.
                  message:
                    type: string
                    description: Description of the problem.
                  traceId:
                    type: string
                    description: Trace ID for debugging.
                  help:
                    type: string
                    description: Currently unused.
      x-snr-doc-urls:
        - /api-reference/ai-search#tag/Search-Stats/operation/GetQueriesSummaryMultipleIndices
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request GET \
              --url 'https://api.synerise.com/search/v2/indices/stats/queries/summary?indexId=SOME_ARRAY_VALUE&dateFrom=SOME_STRING_VALUE&dateTo=SOME_STRING_VALUE&query=SOME_STRING_VALUE&searchType=SOME_STRING_VALUE&groupBy=SOME_STRING_VALUE' \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'
        - lang: Python
          label: Python
          source: |-
            import http.client

            conn = http.client.HTTPSConnection("api.synerise.com")

            headers = { 'Authorization': "Bearer REPLACE_BEARER_TOKEN" }

            conn.request("GET", "/search/v2/indices/stats/queries/summary?indexId=SOME_ARRAY_VALUE&dateFrom=SOME_STRING_VALUE&dateTo=SOME_STRING_VALUE&query=SOME_STRING_VALUE&searchType=SOME_STRING_VALUE&groupBy=SOME_STRING_VALUE", headers=headers)

            res = conn.getresponse()
            data = res.read()

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = null;

            const xhr = new XMLHttpRequest();
            xhr.withCredentials = true;

            xhr.addEventListener("readystatechange", function () {
              if (this.readyState === this.DONE) {
                console.log(this.responseText);
              }
            });

            xhr.open("GET", "https://api.synerise.com/search/v2/indices/stats/queries/summary?indexId=SOME_ARRAY_VALUE&dateFrom=SOME_STRING_VALUE&dateTo=SOME_STRING_VALUE&query=SOME_STRING_VALUE&searchType=SOME_STRING_VALUE&groupBy=SOME_STRING_VALUE");
            xhr.setRequestHeader("Authorization", "Bearer REPLACE_BEARER_TOKEN");

            xhr.send(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const http = require("https");

            const options = {
              "method": "GET",
              "hostname": "api.synerise.com",
              "port": null,
              "path": "/search/v2/indices/stats/queries/summary?indexId=SOME_ARRAY_VALUE&dateFrom=SOME_STRING_VALUE&dateTo=SOME_STRING_VALUE&query=SOME_STRING_VALUE&searchType=SOME_STRING_VALUE&groupBy=SOME_STRING_VALUE",
              "headers": {
                "Authorization": "Bearer REPLACE_BEARER_TOKEN"
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on("data", function (chunk) {
                chunks.push(chunk);
              });

              res.on("end", function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $request = new HttpRequest();
            $request->setUrl('https://api.synerise.com/search/v2/indices/stats/queries/summary');
            $request->setMethod(HTTP_METH_GET);

            $request->setQueryData([
              'indexId' => 'SOME_ARRAY_VALUE',
              'dateFrom' => 'SOME_STRING_VALUE',
              'dateTo' => 'SOME_STRING_VALUE',
              'query' => 'SOME_STRING_VALUE',
              'searchType' => 'SOME_STRING_VALUE',
              'groupBy' => 'SOME_STRING_VALUE'
            ]);

            $request->setHeaders([
              'Authorization' => 'Bearer REPLACE_BEARER_TOKEN'
            ]);

            try {
              $response = $request->send();

              echo $response->getBody();
            } catch (HttpException $ex) {
              echo $ex;
            }
        - lang: Java
          label: Java
          source: |-
            HttpResponse<String> response = Unirest.get("https://api.synerise.com/search/v2/indices/stats/queries/summary?indexId=SOME_ARRAY_VALUE&dateFrom=SOME_STRING_VALUE&dateTo=SOME_STRING_VALUE&query=SOME_STRING_VALUE&searchType=SOME_STRING_VALUE&groupBy=SOME_STRING_VALUE")
              .header("Authorization", "Bearer REPLACE_BEARER_TOKEN")
              .asString();
servers:
  - description: Microsoft Azure EU
    url: https://api.synerise.com
  - description: Microsoft Azure USA
    url: https://api.azu.synerise.com
  - description: Google Cloud Platform
    url: https://api.geb.synerise.com
tags:
  - name: Search Stats
components:
  securitySchemes:
    JWT:
      type: http
      scheme: bearer
      description: |-
        JWT Bearer token. The header looks like this: `Bearer {JWT}`

        Remember to include the space between 'Bearer' and the token.

        Generate a token via the **Authorization** endpoints.
```
