> ## Documentation Index
> Fetch the complete documentation index at: https://docs.doofinder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update in bulk from temporal

> Updates a list of items in the temporal index in a single bulk operation.



## OpenAPI

````yaml /openapi/management-v2.yaml patch /api/v2/search_engines/{hashid}/indices/{name}/temp/items/_bulk
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 `422 Unprocessable Entity` error. 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
servers:
  - url: https://{search_zone}-api.doofinder.com
    variables:
      search_zone:
        enum:
          - eu1
          - us1
          - ap1
        default: eu1
  - url: /
security:
  - api_token: []
  - jwt_token: []
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/
paths:
  /api/v2/search_engines/{hashid}/indices/{name}/temp/items/_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/TooManyItemsBody'
        '422':
          $ref: '#/components/responses/TooManyItemsBulk'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  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_]*$
  schemas:
    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
    IndexableItem:
      title: Item
      description: >-
        A "searchable" element. Items are the objects that form the search
        results.
      type: object
      additionalProperties: true
      properties:
        id:
          type: string
          description: Item id
        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
          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
    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
    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 and errors_in_fields).
              items:
                $ref: '#/components/schemas/ManagementErrorDetail'
          required:
            - code
            - message
      required:
        - error
    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
  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: searchengine_timeout
              message: Timeout connecting to backend
    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
    TooManyItemsBody:
      description: Request Entity Too Large — the bulk payload exceeds 8 MB.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ManagementError'
          example:
            error:
              code: too_many_items
              message: Body is too large (max 8 MB)
    TooManyItemsBulk:
      description: Unprocessable Entity — the bulk array exceeds 100 items.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ManagementError'
          example:
            error:
              code: too_many_items
              message: Too many items in bulk request (max 100)
    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
    InternalServerError:
      description: Internal Server Error — unexpected backend failure.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ManagementError'
          example:
            error:
              code: internal_error
              message: Internal server error
  securitySchemes:
    api_token:
      type: apiKey
      description: |
        Doofinder API key. Pass it as:
        Authorization: Token <api_key>
      name: Authorization
      in: header
    jwt_token:
      type: apiKey
      description: |
        JWT Bearer token. Sign a JWT with your API key (HS256) and pass it as:
        Authorization: Bearer <jwt_token>
      name: Authorization
      in: header

````