openapi: 3.0.0
info:
  title: Management API
  contact:
    name: Management API Support
    url: 'https://docs.doofinder.com/'
  version: '2.0'
  x-logo:
    url: 'https://admin.doofinder.com/images/logo.svg'
    backgroundColor: '#33268C'
    altText: 'Management API Search Engine'
  description: |
    # Introduction

    Management API allows you to perform some of the administrative tasks you can do on your search
    engines using the Admin control panel, directly from your code.

    # Basics

    ## Endpoint

    All requests should be done via `https` to the right endpoint:

    ```
    https://{search-zone}-api.doofinder.com
    ```

    Where `{search-zone}` is the code of the datacenter where your search engines are located.

    For instance:

    ```
    https://eu1-api.doofinder.com
    https://us1-api.doofinder.com
    ```

    ## Authentication

    To authenticate you need an API key. If you don't have one you can generate it in the Admin by going to your Account and then to API Keys, [here](https://admin.doofinder.com/admin/account/api).

    A valid API key looks like this:

    ```
    ab46030xza33960aac71a10248489b6c26172f07
    ```

    ### API Token

    You can authenticate with the previous API key. The correct way to authenticate is to send a HTTP Header with the name `Authorization` and the value `Token {api-key}`.

    I.e.:

    ```
    Authorization: Token ab46030xza33960aac71a10248489b6c26172f07
    ```

    ### JWT Token

    If you prefer you can authenticate with a [JSON Web Token](https://jwt.io). The token must be signed with an API management key and there are some claims required in the JWT payload. These claims are:

      * `iat` (issued at): Creation datetime timestamp, i.e. the moment when the JWT was created.

      * `exp` (expiration time): Expiration datetime timestamp, i.e. the moment when the JWT is going to expire and will no longer be valid. The time span between issued and expiration dates must be shorter than a week.

      * `name`: Your user code. It is your unique identifier as doofinder user. You can find this code in your profile page in the administration panel.

    To authenticate using JWT you must send a HTTP header with the name `Authorization` and the value `Bearer {JWT-token}`.

    I.e.:

    ```
    Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoidGVzdCIsImlhdCI6MTUxNjIzOTAyMn0.QX_3HF-T2-vlvzGDbAzZyc1Cd-J9qROSes3bxlgB4uk
    ```

    ## Conventions

    Along most of the code samples you will find placeholders for some common variable values. They are:

      * `{hashid}`: The search engine's unique id. e.g.: d8fdeab7fce96a19d3fc7b0ca7a1e98b.

      * `{index}`: When storing items, they're always stored under a certain _index_. e.g.: product.

      * `{token}`: Your personal authentication token obtained in the control panel.

    ## Api limits

    ### Requests rate

    The API has a limit of 20 requests per second. If you do more than that, the next requests will get a `429 Too Many Requests` error. There is no penalty associated to that error, but you must wait one second before attempting more requests.

    ### Body size

    The body size for requests with data sending (eg: POST or PUT requests) has a limit of 8MB. If you do a request with a request body bigger than 8 MB, the response will be `413 Payload Too Large`. This is important mostly for batch calls like batch create items.

    ### Batch size

    Bulk item operations (create, update, delete) accept a maximum of **100 items per request**. Requests with more than 100 items will be rejected with a `400 Bad Request` error (`bad_params`). Split larger payloads into batches of up to 100 items.

    # Objects

    ## Search Engines

    A search engine is a collection of indices where data is stored. It has some properties like name, language, and some other configuration options that are shared among all of its indices.

    Each search engine is uniquely identified by its `hashid` which is an auto-generated string.

    Search engines have a _"process"_ operation which takes items from all its data sources and insert them into their indices. This operation has a zero downtime, you can still search into indices while processing.

    ## Indices

    Indices are collections of items, the same way a search engine is a collection of indices. An index also has a set of data sources which usually are urls where the items for indexing are taken from.

    If you need to reindex a whole index you can create a temporary index. The mission of a temporary index is indexing items while you can still search the main index, having zero downtime.

    ## Data Sources

    Data sources are indices items sources. When you process a search engine, we take the items from its data sources and "insert" them into the indices. You do not need any data source if you index items only by API.

    ## Items

    Items are objects stored in an index. Those are the elements you search for when doing query to a search engine. They may have different schemas depending on their index **preset**. For instance, a `product` item will have a price, category, etc.

    In case you want to group items as a product with variants, you have to add these two fields:

    * `group_id`: All the items with the same group id will be members of the group. Could be the parent id or just an independent id.

    * `group_leader`: Boolean indicating if the item is the leader of the variant group, which will be the item shown among its group in the search results. It is not mandatory if there is no item leader.

    You could index the items in any order because the grouping feature is made in search phase.
    An example of request payload would be:

    ```
    [

      {
          "title": "Item Variant 1",
          "link": "http://www.example.com/img/variant1.png",
          "id": "1",
          "df_manual_boost": 1,
          "categories": [...],
          "group_id": "99",
          "group_leader": true
      },

      {
          "title": "Item Variant 2",
          "link": "http://www.example.com/img/variant2.png",
          "id": "2",
          "df_manual_boost": 1,
          "categories": [...],
          "group_id": "99",
          "group_leader": false
      },

    ]
    ```

    ### Items transformations

    When your Index has `product` preset, some defaults are added to your item at creation. For instance

      * `categories` field if not provided, would be a empty list at response `[]`.
      * `best_price` would get the min value between `price` and `sale_price` item fields if present, if not, would be `null`.
      Fields `price` and `sale_price` should be a number like: 15.56.
      If you want to update `best_price`, `price` and `sale_price` should be present.

    When your Index has `generic` preset, this defaults will not be applied.

  termsOfService: 'https://www.doofinder.com/en/terms-and-conditions'
tags:
  - name: Search Engines
    description: All search engines CRUD operations, including handling data sources processing.
  - name: Indices
    description: All indices and temporary indices CRUD operations.
  - name: Items
    description: Handling content of indices. Allows to retrieve and update the items of an index.
  - name: Stats
    description: Provides statistical information about your search engines.
    externalDocs:
      url: https://docs.doofinder.com/api/management/v2/stats/
security:
  - api_token: []
  - jwt_token: []
servers:
  - url: https://{search_zone}-api.doofinder.com
    variables:
      search_zone:
        enum:
          - eu1
          - us1
          - ap1
        default: eu1
  - url: /
components:
  securitySchemes:
    jwt_token:
      type: apiKey
      name: Authorization
      in: header
      description: |
        JWT signed with your API key (HS256). The `Bearer` prefix is part of the header value, so enter it too — the field is sent verbatim as:

            Authorization: Bearer <jwt_token>
      x-default: Bearer <your_jwt_token>
    api_token:
      type: apiKey
      name: Authorization
      in: header
      description: |
        Doofinder API key. The `Token` prefix is part of the header value, so enter it too — the field is sent verbatim as:

            Authorization: Token <api_key>
      x-default: Token <your_api_key>
  schemas:
    SearchEngines:
      title: Search Engines
      type: array
      description: A list of all search engines of a user.
      items:
        $ref: '#/components/schemas/SearchEngine'
      readOnly: true
    SearchEngine:
      title: Search Engine
      type: object
      additionalProperties: false
      required:
        - name
      properties:
        currency:
          default: EUR
          description: Currency used in the search engine in ISO 4217 Code
          enum: &search_engine_currencies
            - AED
            - ARS
            - AUD
            - BAM
            - BDT
            - BGN
            - BOB
            - BRL
            - BYN
            - CAD
            - CHF
            - CLP
            - CNY
            - COP
            - CZK
            - DKK
            - DOP
            - EGP
            - EUR
            - GBP
            - HKD
            - HRK
            - HUF
            - IDR
            - ILS
            - INR
            - IRR
            - ISK
            - JPY
            - KRW
            - KWD
            - MXN
            - MYR
            - NOK
            - NZD
            - PEN
            - PLN
            - RON
            - RSD
            - RUB
            - SAR
            - SEK
            - TRY
            - TWD
            - UAH
            - USD
            - VEF
            - VND
            - XPF
            - ZAR
          example: EUR
          type: string
        hashid:
          type: string
          description: A unique code that identifies a search engine.
          readOnly: true
          example: 123456789012345678901234567890ab
        indices:
          $ref: '#/components/schemas/Indices'
        status:
          type: string
          description:
            Indicates the current status of the search engine.
          readOnly: true
          enum:
            - active
            - inactive
          example: active
        language:
          deprecated: true
          nullable: true
          type: string
          description:
            (DEPRECATED), use `locale` field instead.
            Curently it won't have any effect in the Search Engine.
          example: es
          enum: &search_engine_languages
            - ar
            - hy
            - eu
            - pt-br
            - bg
            - ca
            - cs
            - da
            - nl
            - en
            - fi
            - fr
            - de
            - el
            - hi
            - hu
            - id
            - it
            - no
            - pt
            - ro
            - ru
            - es
            - sv
            - tr
        locale:
          type: string
          description:
            An ISO locale code is a standardized identifier combining language and region codes. 
            The language part, usually a two-letter code, is from ISO 639-1, while the region part 
            (optional, but recommended), often a two or three-letter code, is from ISO 3166-1. 
            Determines the locale of the search engine. The locale affects how the words indexed are
            tokenized and which stopwords to use.
          example: es-ES
        name:
          type: string
          description:
            A short name that helps identifying the search engine.
          example: My Search Engine
        search_url:
          description:
            Indicates the search server domain for this search engine. You should
            use this domain to perform searches to this search engine.
          type: string
          format: uri
          readOnly: true
          example: https://eu1-search.doofinder.com
        stopwords:
          description:
            Ignores high-frequency terms like "the", "and", "is". These words
            have a low weight and contribute little to the relevance score.
          type: boolean
          default: false
          example: false
        default:
          description:
            Indicates if the search engine is the default one for the store.
          type: boolean
          default: false
          example: false
        platform:
          default: api
          description: Indicates which platform the search engine is associated with.
          enum: &search_engine_platforms
            - api
            - shopify
            - woocommerce
            - bigcommerce
            - crawler
            - ecommerce
            - ekm
            - file
            - magento
            - magento2
            - opencart
            - oscommerce
            - prestashop
            - shoper
            - shopware
          type: string
          example: shopify
        has_grouping:
          description:
            When this option is selected, only one of the item variants
            is returned in the search results. This only works if the
            indexed item have the `group_id` field.
          type: boolean
          default: false
        store_id:
          type: string
          description:
            The Store identifier.
          nullable: true
          example: e9d6fcd2-0262-4094-bf3c-671ec5da5455
      description:
        A search engine groups a number of indices. Any search done to the
        search engine takes the best results of all indices beneath. Also,
        search engine options applies to all its indices.
    SearchEngineUpdate:
      title: Search Engine Update
      type: object
      additionalProperties: false
      properties:
        currency:
          description: Currency used in the search engine in ISO 4217 Code
          enum: *search_engine_currencies
          example: EUR
          type: string
        hashid:
          type: string
          description: A unique code that identifies a search engine.
          readOnly: true
          example: 123456789012345678901234567890ab
        indices:
          $ref: '#/components/schemas/Indices'
        status:
          type: string
          description:
            Indicates the current status of the search engine.
          readOnly: true
          enum:
            - active
            - inactive
          example: active
        language:
          deprecated: true
          nullable: true
          type: string
          description:
            (DEPRECATED), use `locale` field instead.
            Curently it won't have any effect in the Search Engine.
          example: es
          enum: *search_engine_languages
        locale:
          type: string
          description:
            An ISO locale code is a standardized identifier combining language and region codes.
            The language part, usually a two-letter code, is from ISO 639-1, while the region part
            (optional, but recommended), often a two or three-letter code, is from ISO 3166-1.
            Determines the locale of the search engine. The locale affects how the words indexed are
            tokenized and which stopwords to use.
          example: es-ES
        name:
          type: string
          description:
            A short name that helps identifying the search engine.
          example: My Search Engine
        search_url:
          description:
            Indicates the search server domain for this search engine. You should
            use this domain to perform searches to this search engine.
          type: string
          format: uri
          readOnly: true
          example: https://eu1-search.doofinder.com
        stopwords:
          description:
            Ignores high-frequency terms like "the", "and", "is". These words
            have a low weight and contribute little to the relevance score.
          type: boolean
          example: false
        default:
          description:
            Indicates if the search engine is the default one for the store.
          type: boolean
          example: false
        platform:
          description: Indicates which platform the search engine is associated with.
          enum: *search_engine_platforms
          type: string
          example: shopify
        has_grouping:
          description:
            When this option is selected, only one of the item variants
            is returned in the search results. This only works if the
            indexed item have the `group_id` field.
          type: boolean
      description:
        Search engine fields to update. Fields not sent keep their current value.
    Indices:
      title: Indices
      type: array
      description: A list of indices for a search engine.
      items:
        $ref: '#/components/schemas/Index'
      readOnly: true
    IndexUpdate:
      title: Update Index Parameters
      type: object
      additionalProperties: false
      properties:
        datasources:
          $ref: '#/components/schemas/DataSources'
      description:
        Index fields allowed for updates.
    Index:
      title: Index
      description:
        Set of options and parameters of an index. They define the way an
        index is built.
      required:
        - name
        - preset
      type: object
      additionalProperties: false
      properties:
        name:
          type: string
          description: Name of the Index. It works as the index identifier.
          pattern: '^[a-z][a-z0-9_]*$'
          example: product
        preset:
          type: string
          description:
            Preset of the index. The preset defines a set of configuration
            parameters for the index like basic fields to be included,
            and field transformations. For instance, the `product` preset
            creates the `best_price` field.
          enum:
            - generic
            - product
            - page
            - category
          example: product
        datasources:
          $ref: '#/components/schemas/DataSources'
    DataSources:
      title: Data Sources
      type: array
      description: List of datasources of an index.
      items:
        $ref: '#/components/schemas/DataSource'
    DataSource:
      title: Data Source
      description:
        Set of options and parameters of a datasource. They define a source
        of documents to be accessed and the required parameters for accessing
        the source.
      required:
        - type
      type: object
      properties:
        type:
          type: string
          description:
            Type of datasource
          enum:
            - bigcommerce
            - ekm
            - file
            - magento2
            - shopify
            - shoper
            - shopware
            - vtex
            - wordpress
        options:
          description:
            DataSource general options. They define required parameters for
            the DataSource to work or options that modify the access to the
            data feed.
          anyOf:
            - title: Bigcommerce Source Options
              description:
                Required parameters to access a `bigcommerce` source.
              type: object
              required:
                - feed_type
              properties:
                feed_type:
                  description:
                    The type of content being indexed
                  type: string
                  enum:
                    - product
                    - blog_post
                    - category
                    - page
            - title: File Source Options
              description: Options allowed for a `file` source.
              type: object
              required:
                - url
              properties:
                feed_type:
                  description:
                    The type of content being indexed.
                  type: string
                  example: "product"
                page_size:
                  description:
                    Sets pagination for a file feed if possible. This option
                    will make the processing be split into multiple steps,
                    fetching the datasource with the `limit` (page size) and
                    `offset` (current index) query parameters.
                  type: integer
                  nullable: true
                  default: null
                url:
                  description:
                    Full URI to the feed used for indexing.
                  type: string
                  example: "https://mydomain.com/feed"
            - title: Magento2 Source Options
              description:
                Required parameters to access a `magento2` source.
              type: object
              required:
                - feed_type
              properties:
                feed_type:
                  description:
                    The type of content being indexed
                  type: string
                  enum:
                    - product
                    - category
                    - page
            - title: Shoper Source Options
              description:
                Required parameters to access a `shoper` source.
              type: object
              required:
                - feed_type
              properties:
                feed_type:
                  description:
                    The type of content being indexed
                  type: string
                  enum:
                    - product
                    - category
                    - collection
                    - article
                    - page
            - title: Shopify Source Options
              description:
                Required parameters to access a `shopify` source.
              type: object
              required:
                - feed_type
              properties:
                feed_type:
                  description:
                    The type of content being indexed
                  type: string
                  enum:
                    - product
                    - blog_post
                    - collection
                    - page
            - title: Shopware Source Optionss
              description:
                Required parameters to access a `shopware` source.
              type: object
              required:
                - feed_type
              properties:
                feed_type:
                  description:
                    The type of content being indexed
                  type: string
                  enum:
                    - product
            - title: VTEX Source Options
              description:
                Required parameters to access a `vtex` source.
              type: object
              required:
                - feed_type
              properties:
                feed_type:
                  description:
                    The type of content being indexed
                  type: string
                  enum:
                    - product
            - title: Wordpress Source Options
              description:
                Required parameters to access a `wordpress` source.
              type: object
              required:
                - feed_type
              properties:
                feed_type:
                  description:
                    The type of content being indexed. It can be any value as it is obtained from the Wordpress API.
                  type: string
                  example: "product"  
      example:
        type: file
        options:
          url: 'https://yourserver/your_data_feed.xml'
    Scroller:
      title: Index Items Scroller
      type: object
      properties:
        total:
          type: integer
          description: Total number of items fetched by the Scroller.
        scroll_id:
          type: string
          description:
            Unique identifier for the Scroller. The id should be provided for
            traversing all items.
        items:
          $ref: '#/components/schemas/Items'
      description:
        A scroller traverses all indexed items. It works like a pointer or pager.
        The first request initializes the scroller and returns the scroller id
        with the first page of items. Subsequent requests for the same scroller
        id will return more results. Notice that the scroller works with an
        snapshot of the index so, if you initialize a scroller and update an
        item later, those changes will not be reflected in the scroller.
        Scrollers have an expiry time of 5 minutes.
      example:
        total: 567
        scroll_id: 1234
        items:
          - title: Item Title
            link: 'http://www.example.com/img/1234.png'
            id: '1234'
            df_manual_boost: 1
            categories:
              - cat1
              - cat2
    MGETResult:
      title:  MultiGet Result
      type: array
      description:
        A list of MGET operation response. Each response shows the item id, if
        it was found, and the original item if it was present in the index.
      items:
        title: Item
        type: object
        properties:
          id:
            type: string
            description: Item id
          found:
            type: boolean
            description: Indicates if the item was found or not.
          item:
            $ref: '#/components/schemas/IndexableItem'
        example:
          id: '1234'
          found: true
          item:
              title: Item Title
              link: 'http://www.example.com/img/1234.png'
              id: '1234'
              df_manual_boost: 1
              categories:
                - cat1
                - cat2
    Items:
      title: Items
      type: array
      description: List of items.
      items:
        $ref: '#/components/schemas/IndexableItem'
      readOnly: true
    ItemsIds:
      title: Items Ids
      type: array
      description: List of items ids with a minimum of 1 item and a maximum of 100.
      items:
        type: object
        properties:
          id:
            description: Unique identifier of the item.
            type: string
      minItems: 1
      maxItems: 100
      uniqueItems: true
      example:
        - id: '1234'
    IndexableItem:
      title: Item
      description:
       'A "searchable" element. Items are the objects that form the search
        results.'
      type: object
      additionalProperties: true
      properties:
        id:
          description: Item id
          type: string
        group_id:
          description:
            This field indicates the group to which this item belongs to. All
            items with the same `group_id` will be collapsed into one
            in search results, returning the most relevant one or the group
            leader if they all have the same score.
          type: string
          nullable: true
        group_leader:
          description:
            This field indicates the item chosen as the default among its group.
            It will be returned in search results if there is no other item with
            a higher score.
          type: boolean
          nullable: true
        df_group_leader:
          description:
            (Deprecated) This field indicates the item chosen as the default among its group.
            It will be returned in search results if there is no other item with
            a higher score.
          type: boolean
          nullable: true
          deprecated: true
        df_manual_boost:
          description:
            A numeric score boosting. It multiplies the natural score of
            the item for a search. For instance, if boost is greater than
            `1.0` the item will appear higher in the results. If it is lower than
            `1.0`, it will appear lower. The minimum value is 0.0.
          type: number
          format: double
          minimum: 0.0
          nullable: true
        categories:
          description: |
            This field has special behaviour when Indice has `product` preset, categories
            shall be specified as:

              ```
              {
                ...
                categories: [
                  'parent category > inner category > leaft category',
                  'other parent > other inner > other leaft'
                ]
              }
              ```

            This way, when using categories field in facets, it will work as expected. When Index has `generic` preset, this works as normal field but it should be string.

          oneOf:
            - type: array
              items:
                type: string
            - type: string
        best_price:
          description: |
            Auto created field that gets the min value between `price` or `sale_price` fields, if added in the document.
            It gets null if doesn't find any of these fields.

                It is not necessary to send this field to index it.
          type: number
          nullable: true
        image_link:
          type: string
          format: uri
          nullable: true
        link:
          type: string
          format: uri
          nullable: true
        title:
          type: string
          nullable: true
      example:
        title: Adidas Originals Trefoil Hoodie
        link: 'https://woocommerce.doofinder.com/product/adidas-originals-trefoil-hoodie/'
        image_link: 'https://woocommerce.doofinder.com/wp-content/uploads/2024/02/suda-6-scaled.jpg'
        id: '1234'
        color: blue
        price: 15.99
        sale_price: 11.99
        categories:
          - Clothes > Hoodie
          - Men > Hoodie
    BulkRequest:
      title: Bulk Request
      type: array
      description:
        A list of items data for a bulk operation with a minimum of 1 item and a maximum of 100.
      items:
        $ref: '#/components/schemas/IndexableItem'
      minItems: 1
      maxItems: 100
    BulkResult:
      title: Bulk Result
      description: Result for bulk operations.
      type: object
      properties:
        results:
          description: List of results of each bulk operation.
          type: array
          items:
            type: object
            properties:
              result:
                description: Result of the operation.
                type: string
                enum:
                  - created
                  - updated
                  - deleted
              id:
                description: Item unique identifier.
                type: string
              error:
                description: Result error of the operation.
                type: string
                nullable: true
        errors:
          description: Indicates if there is any error in the results.
          type: boolean
      example:
        results:
          - result: updated
            id: '1234'
        errors: false
    ProcessingTask:
      title: Processing Task
      description: Details of a processing task.
      type: object
      properties:
        status:
          description: Status of the task.
          type: string
        result:
          description:
            Result of the task. It will be just `OK` or some error description.
          type: string
        finished_at:
          description: ISO 8601 datetime string when the task has finished.
          type: string
          nullable: true
      example:
        status: SUCCESS
        result: OK
        finished_at: '2019-10-18T10:32:21.158Z'
    ReindexingTask:
      title: Reindexing Task
      description: Details of a reindexing task.
      type: object
      properties:
        status:
          description:
            Indicates the current status of the task.
          type: string
          enum:
            - completed
            - reindexing
            - error
            - failure
          readOnly: true
        progress:
          description:
            Indicates the progress of the reindexing operation.
            For instance, 0.5 means the task is half complete. (Minimum 0.0 and maximum 1.0)
          type: number
          format: float
          minimum: 0.0
          maximum: 1.0
          readOnly: true
        failures:
          description:
            If status is `failure` this contains a list of all
            failures recieved while reindexing.
          type: array
          items:
            type: string
            example:
              "failed to parse field [price] of type [short] in document with id
              'id'. Preview of field's value: 'nil'"
        error:
          description:
            If status is `error` this shows the error details.
          type: object
          properties:
            reason:
              description:
                A verbose description of the error returned.
              type: string
            type:
              description:
                Type of error
              type: string
      example:
        progress: 1.0
        status: completed
    ManagementErrorDetail:
      type: object
      description: Details about a specific validation failure on a field.
      properties:
        name:
          type: string
          description: Field name.
          example: language
        fields:
          type: array
          items:
            type: string
          description: Affected field names.
          example:
            - language
        reason:
          type: string
          description: Validation failure reason.
          example: is invalid
    ManagementError:
      type: object
      description: Standard error wrapper for all Management API error responses.
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Machine-readable error code.
              example: not_found
            message:
              type: string
              description: Human-readable error description.
              example: Not found
            details:
              type: array
              description: Optional list of per-field validation details (present on bad_params).
              items:
                $ref: '#/components/schemas/ManagementErrorDetail'
          required:
            - code
            - message
      required:
        - error
  parameters:
    searchengine_hashid:
      name: hashid
      in: path
      description:
        Unique id of a search engine.
      required: true
      schema:
        type: string
        pattern: '^[a-f0-9]{32}$'
    index_name:
      name: name
      in: path
      description:
        Name of an index.
      required: true
      schema:
        type: string
        pattern: '^[a-z][a-z0-9_]*$'
    item_id:
      name: item_id
      in: path
      description: Unique identifier of an item inside an index.
      required: true
      schema:
        type: string
    from:
      name: from
      in: query
      description: 'Start date of the period in the format of UNIX timestamp or YYYYMMDD.'
      required: true
      schema:
        type: string
        pattern: '^20\d{2}(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$|^\d{10}|^\d{13}$'
    to:
      name: to
      in: query
      description: 'End date of the period in the format of UNIX timestamp or YYYYMMDD.'
      required: true
      schema:
        type: string
        pattern: '^20\d{2}(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$|^\d{10}$|^\d{13}'
    format:
      name: format
      in: query
      description: Indicates which response format should be used
      schema:
        type: string
        default: json
        enum: [json, csv]
    tz:
      name: tz
      in: query
      description: |
        The timezone for the given dates, by default, assumes ETC/UTC.
        In naming your time zones, you must stick to those indicated in the TZ database name column [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
      schema:
        type: string
        default: Etc/UTC
      example:
        Europe/Madrid
    device:
      name: device
      in: query
      description: 'Filter by kind of device.'
      schema:
        type: string
        enum: [desktop, mobile]
    facet:
      name: facet
      in: query
      description: Filter by a facet.
      schema:
        type: array
        items:
          type: string
    query_name:
      name: query_name
      in: query
      description:
        Type of query to filter by.
        Arrays parameters must be in the format `param[]=value`.
      schema:
        type: array
        items:
          type: string
    total_hits:
      name: total_hits
      in: query
      description: Filter by the number of search results.
      schema:
        type: integer
    exclude:
      name: exclude
      in: query
      description: Exclude filters
      schema:
        type: object
        properties:
          total_hits:
            type: integer
            description: Exclude by the number of search results.
  responses:
    BulkResponse:
      description:
        Bulk operation successful.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BulkResult'
    BadRequest:
      description: 'Bad Request — invalid or missing parameters.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ManagementError'
          example:
            error:
              code: bad_params
              message: Bad parameters error
              details:
                - name: language
                  fields:
                    - language
                  reason: is invalid
    Unauthorized:
      description: 'Unauthorized — no valid API token provided.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ManagementError'
          example:
            error:
              code: not_authenticated
              message: Authentication required
    Forbidden:
      description: 'Forbidden — token is valid but does not have access to this resource.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ManagementError'
          example:
            error:
              code: access_denied
              message: Access denied
    NotFound:
      description: 'Not Found — the requested resource does not exist.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ManagementError'
          example:
            error:
              code: not_found
              message: Not found
    Timeout:
      description: 'Request Timeout — the search engine or index is busy; retry after a short delay.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ManagementError'
          example:
            error:
              code: timeout
              message: Timeout error
    Conflict:
      description: 'Conflict — the search engine is locked for processing or in an inactive state.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ManagementError'
          example:
            error:
              code: searchengine_locked
              message: Search engine is being processed
    ConflictInactive:
      description: 'Conflict — the search engine is in an inactive state.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ManagementError'
          example:
            error:
              code: searchengine_inactive
              message: Your search engine is inactive and can not be modified.
    ConflictIndexExists:
      description: 'Conflict — an index with that name already exists.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ManagementError'
          example:
            error:
              code: index_exists
              message: Index already exists
    ConflictTooManyTemp:
      description: 'Conflict — a temporary index already exists for this index.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ManagementError'
          example:
            error:
              code: too_many_temporary
              message: A temporary index already exists for this index
    ConflictReindexInProgress:
      description: 'Conflict — a reindex to the temporary index is already in progress.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ManagementError'
          example:
            error:
              code: reindex_in_progress
              message: A reindex to the temporary index is already in progress
    PayloadTooLarge:
      description: 'Payload Too Large — the request body exceeds the size limit.'
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                properties:
                  message:
                    type: string
                required:
                  - message
            required:
              - error
          example:
            error:
              message: Request body is too large
    ServiceUnavailable:
      description: 'Service Unavailable — an internal service required to complete the request failed.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ManagementError'
          example:
            error:
              code: service_unavailable
              message: An internal service required to complete the request failed
    TooManyRequests:
      description: 'Too Many Requests — rate limit exceeded; back off and retry.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ManagementError'
          example:
            error:
              code: too_many_requests
              message: Too many requests per second
    InternalServerError:
      description: 'Internal Server Error — unexpected backend failure.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ManagementError'
          example:
            error:
              code: unexpected_error
              message: An unexpected error has ocurred
paths:
  '/api/v2/search_engines/{hashid}/indices/{name}/temp/items/{item_id}':
    get:
      tags:
        - Items
      summary: Get from temporal
      description: Gets an item from the temporal index by its id.
      operationId: items_temp_show
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
        - $ref: '#/components/parameters/item_id'
      responses:
        200:
          description: Item retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IndexableItem'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/ConflictInactive'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
    delete:
      tags:
        - Items
      summary: Delete from temporal
      description: Deletes an item from the temporal index given its id.
      operationId: items_temp_delete
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
        - $ref: '#/components/parameters/item_id'
      responses:
        '204':
          description: Item deleted.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/ConflictInactive'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
    patch:
      tags:
        - Items
      summary: Update from temporal
      description:
        Partially updates an item in the temporal index given its id. The operation
        will return the updated item.
      operationId: items_temp_update
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
        - $ref: '#/components/parameters/item_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IndexableItem'
        required: true
      responses:
        200:
          $ref: '#/components/responses/BulkResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
      x-codegen-request-body-name: item
  '/api/v2/search_engines/{hashid}/indices/{name}/temp/items/_bulk':
    post:
      tags:
        - Items
      summary: Create in bulk in temporal
      description:
        Creates a list of items in the temporal index in a single bulk
        operation.
      operationId: items_temp_bulk_create
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkRequest'
        required: true
      responses:
        200:
          $ref: '#/components/responses/BulkResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/Conflict'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
      x-codegen-request-body-name: bulk
    delete:
      tags:
        - Items
      summary: Delete in bulk from temporal
      description:
        Deletes a list of items in the temporal index in a single bulk
        operation.
      operationId: items_temp_bulk_delete
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ItemsIds'
        required: true
      responses:
        200:
          $ref: '#/components/responses/BulkResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/Conflict'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
      x-codegen-request-body-name: bulk
    patch:
      tags:
        - Items
      summary: Update in bulk from temporal
      description:
        Updates a list of items in the temporal index in a single bulk
        operation.
      operationId: items_temp_bulk_update
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkRequest'
        required: true
      responses:
        200:
          $ref: '#/components/responses/BulkResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/Conflict'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
      x-codegen-request-body-name: bulk
  '/api/v2/search_engines/{hashid}/indices/{name}/temp/items/':
    post:
      tags:
        - Items
      summary: Create in temporal
      description: Creates an item with the data provided in the temporal index.
      operationId: items_temp_create
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IndexableItem'
        required: true
      responses:
        201:
          description: Item created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IndexableItem'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
      x-codegen-request-body-name: item
  '/api/v2/search_engines/{hashid}/indices/{name}/temp/items/_mget':
    post:
      tags:
        - Items
      summary: Find by ids from temporal
      description:
        Finds a list items from a temporal index in a single operation by a list of ids.
      operationId: items_temp_mget
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ItemsIds'
        required: true
      responses:
        200:
          description: Mget succeed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MGETResult'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/ConflictInactive'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
  '/api/v2/search_engines/{hashid}/indices/{name}/items/{item_id}':
    get:
      tags:
        - Items
      summary: Get
      description: Gets an item from the index by its id.
      operationId: item_show
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
        - $ref: '#/components/parameters/item_id'
      responses:
        200:
          description: Item retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IndexableItem'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/ConflictInactive'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
    delete:
      tags:
        - Items
      summary: Delete
      description: Deletes item from the index by its id.
      operationId: item_delete
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
        - $ref: '#/components/parameters/item_id'
      responses:
        '204':
          description: Item deleted.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
    patch:
      tags:
        - Items
      summary: Update
      description:
        Partially updates item from index by its id. The operation returns the
        updated item.
      operationId: item_update
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
        - $ref: '#/components/parameters/item_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IndexableItem'
        required: true
      responses:
        200:
          description: Item updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IndexableItem'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
      x-codegen-request-body-name: item
  '/api/v2/search_engines/{hashid}/indices/{name}/items/_bulk':
    post:
      tags:
        - Items
      summary: Create in bulk
      description:
        Creates a list of items in the index in a single bulk operation.
      operationId: items_bulk_create
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkRequest'
        required: true
      responses:
        200:
          $ref: '#/components/responses/BulkResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/Conflict'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
      x-codegen-request-body-name: bulk
    delete:
      tags:
        - Items
      summary: Delete in bulk
      description:
        Deletes a list of items from the index in a single bulk operation.
      operationId: items_bulk_delete
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ItemsIds'
        required: true
      responses:
        200:
          $ref: '#/components/responses/BulkResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/Conflict'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
      x-codegen-request-body-name: bulk
    patch:
      tags:
        - Items
      summary: Update in bulk
      description:
        Updates a list of items from the index in a single bulk operation.
      operationId: items_bulk_update
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkRequest'
        required: true
      responses:
        200:
          $ref: '#/components/responses/BulkResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/Conflict'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
      x-codegen-request-body-name: bulk
  '/api/v2/search_engines/{hashid}/indices/{name}/items/':
    get:
      tags:
        - Items
      summary: Scroll index
      description:
        Scrolls through all the items of an index. The first request starts the
        scroll and generate a scroll id that can be traversed with each
        successive requests. There is a limited time period on which the
        traverse is possible. After 5 minutes the scroll expires and it is no
        longer accesible, a new request should be made to traverse items again
        from the beginning.
      operationId: item_index
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
        - name: scroll_id
          in: query
          description:
            'Unique identifier for the scroll. The scroll saves a "pointer" to
            the last fetched page so each successive request to the same
            scroll_id return a new page.'
          schema:
            type: string
        - name: rpp
          in: query
          description: Results per page. How many items are fetched per page/request with a maximum of 100.
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 100
        - name: use_full_index
          in: query
          description: Use full index. If true, the full index name will be used instead of the alias. Usually used so the out of stock items are included.
          schema:
            type: boolean
            default: false
        - name: group_id
          in: query
          description:
            'Item variant group identifier. Useful param to filter by a specific variant.'
          required: false
          schema:
            type: string
      responses:
        200:
          description: Scroller retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Scroller'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/ConflictInactive'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
    post:
      tags:
        - Items
      summary: Create
      description: Creates an item in the index with the data provided.
      operationId: item_create
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IndexableItem'
        required: true
      responses:
        '201':
          description: Item created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IndexableItem'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
      x-codegen-request-body-name: item
  '/api/v2/search_engines/{hashid}/indices/{name}/items/_mget':
    post:
      tags:
        - Items
      summary: Find by ids
      description:
        Finds a list items in a single operation by a list of ids.
      operationId: item_mget
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ItemsIds'
        required: true
      responses:
        200:
          description: Mget succeed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MGETResult'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/ConflictInactive'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
  '/api/v2/search_engines/{hashid}/indices/{name}/items/_count':
    get:
      tags:
        - Items
      summary: Items count
      description:
        Returns the total number of items in an index.
      operationId: item_count
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
      responses:
        200:
          description: Count succeeded.
          content:
            application/json:
              schema:
                type: object
                properties:
                  count:
                    type: integer
                    description: total items on indice
              example:
                count: 100
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/ConflictInactive'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
  '/api/v2/search_engines/{hashid}/indices/{name}/temp/':
    post:
      tags:
        - Indices
      summary: Create temporary index
      description: |
        Creates a new empty temporary index for the same index name. There can
        not be two temporary indices at the same time, so any request made to
        this endpoint when there is one created will fail. Creating a temporary
        index also sets a lock preventing any changes on the search engine until
        the temporary index is deleted.
      operationId: temporary_index_create
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
      responses:
        '201':
          description: Temporary index created.
          content:
            application/json:
              schema:
                type: object
                properties: {}
              example:
                status: OK
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/ConflictTooManyTemp'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
    delete:
      tags:
        - Indices
      summary: Delete temporary index
      description: |
        Deletes the temporary index. This also removes the lock in the search
        engine. If there is no temporary index this will return a 404 (Not found).
      operationId: temporary_index_delete
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
      responses:
        '204':
          description: Temporary index deleted.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
  '/api/v2/search_engines/{hashid}/indices/{name}/_replace_by_temp/':
    post:
      tags:
        - Indices
      summary: Replace indices
      description: |
        Replaces the content of the current "production" index with the content
        of the temporary one.
      operationId: replace_by_temp
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
      responses:
        200:
          description:
            Indices replacement completed.
          content:
            application/json:
              schema:
                type: object
                properties: {}
              example:
                status: OK
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
  '/api/v2/search_engines/{hashid}/indices/{name}/_reindex_to_temp/':
    get:
      tags:
        - Indices
      summary: Reindexing task status
      description: |
        Returns the status of the last scheduled reindexing tasks. If there is
        none, or the task finished more than 24 hours ago, it will return a 404 error.
      operationId: get_reindexing_status
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
      responses:
        200:
          description:
            The current reindexing taks was retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReindexingTask'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
    post:
      tags:
        - Indices
      summary: Reindex into temporary index
      description: |
        This executes a reindexing operation between the real index and the
        temporary one. It reads all items from the real and index them onto the
        temporary.
        This will return a 404 (Not found) if there is no temporary index.
      operationId: reindex_to_temp
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
      responses:
        200:
          description:
            Reindexing task scheduled successfully.
          content:
            application/json:
              schema:
                type: object
                properties: {}
              example:
                status: OK
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/ConflictReindexInProgress'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
  '/api/v2/search_engines/{hashid}/indices/{name}':
    get:
      tags:
        - Indices
      summary: Get
      description: Gets a search engine index.
      operationId: index_show
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
      responses:
        200:
          description: Index retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Index'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
    delete:
      tags:
        - Indices
      summary: Delete
      description: Deletes a search engine index.
      operationId: index_delete
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
      responses:
        '204':
          description: Index deleted.
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
    patch:
      tags:
        - Indices
      summary: Update
      description: Updates a search engine index.
      operationId: index_update
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
        - $ref: '#/components/parameters/index_name'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IndexUpdate'
        required: true
      responses:
        200:
          description: Index was updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Index'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
      x-codegen-request-body-name: index
  '/api/v2/search_engines/{hashid}/indices':
    get:
      tags:
        - Indices
      summary: List
      description: List all indices of search engine.
      operationId: index_index
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
      responses:
        200:
          description: Indices retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Indices'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
    post:
      tags:
        - Indices
      summary: Create
      description: Creates a new index for a search engine.
      operationId: index_create
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Index'
        required: true
      responses:
        '201':
          description: Index created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Index'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '409':
          $ref: '#/components/responses/ConflictIndexExists'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
      x-codegen-request-body-name: index
  '/api/v2/search_engines/{hashid}/_process':
    get:
      tags:
        - Search Engines
      summary: Get process task status
      description:
        Gets the status of the last process task. Status persists for 72 hours.
        If there is no recent task, it will return an error.
      operationId: process_status
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
      responses:
        200:
          description: Task details retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProcessingTask'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/ConflictInactive'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
    post:
      tags:
        - Search Engines
      summary: Process
      description:
        Schedules a task for processing all search engine's data sources.
      operationId: process
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                callback_url:
                  description:
                    When the tasks finishes, the systems calls to the provided URL
                    giving the final status of the task. URL must use HTTPS.
                    The call will be a POST, with the data result on the body.
                  type: string
                  format: url
                  example: https://example_url.com
      responses:
        '201':
          description: Tasks succesfully scheduled.
          content:
            application/json:
              schema:
                title: Process Task
                description: Task succesfylly scheduled.
                type: object
                properties:
                  href:
                    description: Url to call to, gets the state of the indexation process (GET).
                    type: string
                  message:
                    description: Result of the task created.
                    type: string
                example:
                  href: /api/v2/search_engines/{hashid}/_process
                  message: PROCESS_CREATED
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
  '/api/v2/search_engines/{hashid}':
    get:
      tags:
        - Search Engines
      summary: Get
      description: Gets a search engine details.
      operationId: search_engine_show
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
      responses:
        200:
          description: Search engine retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchEngine'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
    delete:
      tags:
        - Search Engines
      summary: Delete
      description: Deletes a search engine.
      operationId: search_engine_delete
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
      responses:
        '204':
          description: Search engines deleted.
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
    patch:
      tags:
        - Search Engines
      summary: Update
      description: Updates a search engine.
      operationId: search_engine_update
      parameters:
        - $ref: '#/components/parameters/searchengine_hashid'
      requestBody:
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/SearchEngineUpdate'
                - anyOf:
                    - type: object
                      properties:
                        locale: {}
                      required:
                        - locale
                    - type: object
                      properties:
                        language:
                          type: string
        required: true
      responses:
        200:
          description: Search engines updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchEngine'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
      x-codegen-request-body-name: searchengine
  '/api/v2/search_engines':
    get:
      tags:
        - Search Engines
      summary: List
      description: Lists all user's search engines.
      operationId: search_engine_list
      responses:
        200:
          description: Search engines retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchEngines'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
    post:
      tags:
        - Search Engines
      summary: Create
      description:
        Creates a new search engine with the provided data. It is not possible to run searches
        against the new search engine as it does not have any index yet. You must create an index
        belonging to the new search engine to be able to make searches.
      operationId: search_engine_create
      requestBody:
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/SearchEngine'
                - type: object
                  properties:
                    store_id: {}
                  required:
                    - store_id
                - anyOf:
                    - type: object
                      properties:
                        locale: {}
                      required:
                        - locale
                    - type: object
                      properties:
                        language: {}
                      required:
                        - language
        required: true
      responses:
        '201':
          description: Search engine created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchEngine'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
      x-codegen-request-body-name: searchengine
