# Get rules

- Operation ID: `GetRulesV2`
- HTTP method: `GET`
- Path: `/search/v2/indices/{indexId}/rules`
- [Human-readable API reference](https://hub.synerise.com/api-reference/ai-search#tag/Query-Rules/operation/GetRulesV2)

## Self-contained OpenAPI method

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

```yaml
openapi: 3.0.0
info:
  title: Synerise Public API
  version: 1.9.1
paths:
  /search/v2/indices/{indexId}/rules:
    get:
      summary: Get rules
      description: |
        Retrieves a list of rules.

        ---

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

        **API key permission required:** `QUERY_RULES_SEARCH_READ`

        **User role permission required:** `assets_search: read`
      operationId: GetRulesV2
      tags:
        - Query Rules
      security:
        - JWT: []
      parameters:
        - in: path
          name: indexId
          required: true
          description: ID of the index
          schema:
            type: string
        - name: status
          in: query
          required: false
          description: Only rules with this status will be retrieved.
          schema:
            type: string
            enum:
              - finished
              - draft
              - paused
              - scheduled
              - active
        - name: name
          in: query
          required: false
          description: Only rules containing this name will be retrieved.
          schema:
            type: string
        - name: page
          in: query
          description: Page number to return for pagination. The first page has the index `1`.
          required: false
          schema:
            type: integer
            format: int32
            example: 4
            default: 1
        - name: limit
          in: query
          description: The number of items to return per page
          required: false
          schema:
            type: integer
            format: int32
            example: 100
            default: 1000
            maximum: 1000
        - name: sortBy
          in: query
          required: false
          description: Name of the attribute by which the data will be sorted
          schema:
            type: string
        - name: ordering
          in: query
          required: false
          description: Sorting order
          schema:
            type: string
            default: desc
            enum:
              - desc
              - asc
        - name: includeMeta
          in: query
          required: false
          description: |
            
            When `true`, pagination metadata is included in the response body.

            When `false`, the data is included in the response headers:

            - Link: links to neighbors, first, and last pages in pagination.

            - X-Pagination-Total-Count: total number of items on all pages

            - X-Pagination-Total-Pages: total number of pages

            - X-Pagination-Page: current page

            - X-Pagination-Limit: maximum number of items on a page

            - X-Pagination-Sorted-By: parameter that the items were sorted by

            - X-Pagination-Ordering: sorting direction
          schema:
            type: boolean
            default: false
        - in: query
          name: directoryId
          required: false
          description: Requested directoryId of the rule.
          schema:
            type: string
            format: uuid
        - in: query
          name: search
          required: false
          description: Requested part of the name or the id of the rule.
          schema:
            type: string
        - name: consequenceType
          in: query
          required: false
          description: Only rules producing at least one of the given consequence types will be retrieved. May be repeated.
          style: form
          explode: true
          schema:
            type: array
            items:
              type: string
              enum:
                - hide
                - promote
                - standardFilter
                - elasticFilter
                - boost
                - topHits
                - sortBy
                - customData
                - returnNoData
                - distinctFilter
                - pinFacet
                - hideFacet
                - replaceWord
                - removeWord
                - replaceQuery
                - scoringOverride
      responses:
        "200":
          description: List of rules
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    description: A list of rules
                    items:
                      type: object
                      description: Details of the rule
                      properties:
                        status:
                          description: Status of the rule
                          type: string
                        rule:
                          type: object
                          description: Configuration of the rule
                          properties:
                            id:
                              type: integer
                              description: ID of the rule
                            name:
                              type: string
                              description: Name of the rule
                            author:
                              description: The user who created the rule
                              type: integer
                            state:
                              type: string
                              description: State of the rule
                              enum:
                                - draft
                                - active
                                - paused
                                - finished
                            activeFrom:
                              type: string
                              description: Time when the rules becomes active, in YYYY-MM-DD HH-MM-SS format
                            activeTo:
                              type: string
                              description: Time when the rule becomes inactive, in YYYY-MM-DD HH-MM-SS format
                            timezone:
                              type: string
                              description: Timezone in `UTC[+/-]X` format, for example `UTC+4`, `UTC+0`, `UTC-3`
                            updatedAt:
                              type: string
                              description: Last update time in YYYY-MM-DD HH-MM-SS format
                            createdAt:
                              type: string
                              description: Creation time in YYYY-MM-DD HH-MM-SS format
                            data:
                              type: object
                              description: This object contains the details of what the rule does
                              required:
                                - conditions
                                - queryConsequences
                                - postQueryConsequences
                              properties:
                                audience:
                                  type: object
                                  description: Optional audience the rule will be applied to
                                  properties:
                                    segmentationIds:
                                      type: array
                                      description: Ids of segmentations to which client belongs
                                      example:
                                        - 34ab56cd-789be-22ee-11ab-123456789abc
                                        - 12xy34z5-456b-33cc-7o52-987654321ece
                                      items:
                                        type: string
                                conditions:
                                  type: object
                                  description: Additional conditions
                                  properties:
                                    patterns:
                                      type: array
                                      description: Strings that trigger this rule when included in the query
                                      example:
                                        - phone
                                        - notebook
                                        - mouse {color} {brand}
                                      items:
                                        type: string
                                    matchingType:
                                      type: string
                                      description: Match logic of the rule
                                      enum:
                                        - is
                                        - startsWith
                                        - endsWith
                                        - contains
                                    contexts:
                                      type: array
                                      description: Contexts for which the rule will be considered during matching
                                      example:
                                        - listing
                                        - web
                                        - mobile
                                      items:
                                        type: string
                                    filters:
                                      type: object
                                      description: You can configure a condition so that the rule only applies depending on the filters used in a search query.
                                      properties:
                                        textFilters:
                                          type: object
                                          description: Condition filters for text attributes
                                          example:
                                            color:
                                              values:
                                                - green
                                                - red
                                              matchingType: InUserFilters
                                          additionalProperties:
                                            type: object
                                            description: Values and a matching type for a single text attribute. The name of this object must be the same as the name of the attribute.
                                            properties:
                                              values:
                                                type: array
                                                description: An array of strings to match the attribute value with
                                                items:
                                                  type: string
                                              matchingType:
                                                type: string
                                                description: |
                                                  Match logic of the filters for a given attribute. Condition filters and customer search filters are compared as mathematical sets.

                                                  - `Exact`: the customer's search filters must be exactly the same as this condition filter.
                                                  - `ContainsUserFilters`: this condition filter must contain all the customer's search filters (but can also contain other filters).
                                                  - `InUserFilters`: the customer's search filter must contain all of this condition filter (but can also contain other filters)
                                                  - `NonEmptyIntersectionWithUserFilters`: at least one of the customer's search filters must match a value from this condition filter.

                                                  **Example:**:

                                                  - The customer's filters are `color == "green" OR color == "white" OR color == "red"`.
                                                  - The condition filter is `color == ["green","red"]`.

                                                  The result is:
                                                  - `Exact`: does not match, the sets are different.
                                                  - `ContainsUserFilters`: does not match, some customer filters are not included in the condition filters
                                                  - `InUserFilters`: matches, `"green"` and `"red"` are included in `["green","white","red"]`.
                                                  - `NonEmptyIntersectionWithUserFilters`: matches, there is at least one common element
                                                enum:
                                                  - Exact
                                                  - ContainsUserFilters
                                                  - InUserFilters
                                                  - NonEmptyIntersectionWithUserFilters
                                        rangeFilters:
                                          type: object
                                          description: Condition filters for range attributes
                                          example:
                                            price:
                                              ranges:
                                                - rightEnd:
                                                    value: 20
                                                    inclusive: true
                                              matchingType: Exact
                                          additionalProperties:
                                            type: object
                                            description: Ranges and a matching type for a single range attribute. The name of this object must be the same as the name of the attribute.
                                            properties:
                                              ranges:
                                                type: array
                                                description: An array of ranges to match the attribute value with.
                                                items:
                                                  type: object
                                                  properties:
                                                    leftEnd:
                                                      description: Lower boundary of the range. If not defined (this object is not sent at all), defaults to infinity.
                                                      allOf:
                                                        - type: object
                                                          properties:
                                                            value:
                                                              type: number
                                                              description: Numerical value
                                                            inclusive:
                                                              type: boolean
                                                              description: If TRUE, `<` becomes `<=` and `>` becomes `>=`.
                                                    rightEnd:
                                                      description: Upper boundary of the range. If not defined (this object is not sent at all), defaults to infinity.
                                                      allOf:
                                                        - type: object
                                                          properties:
                                                            value:
                                                              type: number
                                                              description: Numerical value
                                                            inclusive:
                                                              type: boolean
                                                              description: If TRUE, `<` becomes `<=` and `>` becomes `>=`.
                                              matchingType:
                                                type: string
                                                description: |
                                                  Match logic of the filters for a given attribute. Condition filters and customer search filters are compared as mathematical sets.

                                                  - `Exact`: the customer's search filters must be exactly the same as this condition filter.
                                                  - `ContainsUserFilters`: this condition filter must contain all the customer's search filters (but can also contain other filters).
                                                  - `InUserFilters`: the customer's search filter must contain all of this condition filter (but can also contain other filters)
                                                  - `NonEmptyIntersectionWithUserFilters`: at least one of the customer's search filters must match a value from this condition filter.

                                                  **Example:**:

                                                  - The customer's filters are `color == "green" OR color == "white" OR color == "red"`.
                                                  - The condition filter is `color == ["green","red"]`.

                                                  The result is:
                                                  - `Exact`: does not match, the sets are different.
                                                  - `ContainsUserFilters`: does not match, some customer filters are not included in the condition filters
                                                  - `InUserFilters`: matches, `"green"` and `"red"` are included in `["green","white","red"]`.
                                                  - `NonEmptyIntersectionWithUserFilters`: matches, there is at least one common element
                                                enum:
                                                  - Exact
                                                  - ContainsUserFilters
                                                  - InUserFilters
                                                  - NonEmptyIntersectionWithUserFilters
                                        datetimeFilters:
                                          type: object
                                          description: Condition filters for datetime attributes
                                          example:
                                            created:
                                              ranges:
                                                - rightEnd:
                                                    value: 2024-01-01
                                                    inclusive: true
                                              matchingType: Exact
                                          additionalProperties:
                                            type: object
                                            description: Ranges and a matching type for a single datetime attribute. The name of this object must be the same as the name of the attribute.
                                            properties:
                                              ranges:
                                                type: array
                                                description: An array of ranges to match the attribute value with.
                                                items:
                                                  type: object
                                                  properties:
                                                    leftEnd:
                                                      description: Lower boundary of the range. If not defined (this object is not sent at all), defaults to infinity.
                                                      allOf:
                                                        - type: object
                                                          properties:
                                                            value:
                                                              type: string
                                                              description: ISO datetime value
                                                            inclusive:
                                                              type: boolean
                                                              description: If TRUE, `<` becomes `<=` and `>` becomes `>=`.
                                                    rightEnd:
                                                      description: Upper boundary of the range. If not defined (this object is not sent at all), defaults to infinity.
                                                      allOf:
                                                        - type: object
                                                          properties:
                                                            value:
                                                              type: string
                                                              description: ISO datetime value
                                                            inclusive:
                                                              type: boolean
                                                              description: If TRUE, `<` becomes `<=` and `>` becomes `>=`.
                                              matchingType:
                                                type: string
                                                description: |
                                                  Match logic of the filters for a given attribute. Condition filters and customer search filters are compared as mathematical sets.

                                                  - `Exact`: the customer's search filters must be exactly the same as this condition filter.
                                                  - `ContainsUserFilters`: this condition filter must contain all the customer's search filters (but can also contain other filters).
                                                  - `InUserFilters`: the customer's search filter must contain all of this condition filter (but can also contain other filters)
                                                  - `NonEmptyIntersectionWithUserFilters`: at least one of the customer's search filters must match a value from this condition filter.

                                                  **Example:**:

                                                  - The customer's filters are `color == "green" OR color == "white" OR color == "red"`.
                                                  - The condition filter is `color == ["green","red"]`.

                                                  The result is:
                                                  - `Exact`: does not match, the sets are different.
                                                  - `ContainsUserFilters`: does not match, some customer filters are not included in the condition filters
                                                  - `InUserFilters`: matches, `"green"` and `"red"` are included in `["green","white","red"]`.
                                                  - `NonEmptyIntersectionWithUserFilters`: matches, there is at least one common element
                                                enum:
                                                  - Exact
                                                  - ContainsUserFilters
                                                  - InUserFilters
                                                  - NonEmptyIntersectionWithUserFilters
                                queryConsequences:
                                  type: array
                                  description: An array of transformations to be performed on the query
                                  items:
                                    type: object
                                    properties:
                                      type:
                                        type: string
                                        description: |
                                          The action to perform

                                          - `removeWord` removes a word from the query.
                                          - `replaceWord` replaces a word from the query with a string.
                                          - `replaceQuery` replaces the entire query.

                                          **IMPORTANT:**

                                          These operations are performed on strings that match the pattern exactly. For example:

                                          1. The pattern is `foo bar`.
                                          1. The operation is set to `removeWord` and `word` is set to `foo`.
                                          1. The user searches for `foo bar bar foo`.

                                          **The result:** "foo" is removed from "foo bar" and the transformed query is now "bar bar foo".
                                        enum:
                                          - removeWord
                                          - replaceWord
                                          - replaceQuery
                                      word:
                                        type: string
                                        description: The word to replace or remove
                                      replacement:
                                        type: string
                                        description: The string that replaces the word/query
                                postQueryConsequences:
                                  type: object
                                  description: This object describes how the rule affects the search results
                                  properties:
                                    hideHits:
                                      type: array
                                      description: An array of items to hide from the results, identified by `itemId`
                                      items:
                                        type: string
                                    promoteHits:
                                      type: array
                                      description: An array of items to show first in the results
                                      items:
                                        type: object
                                        properties:
                                          id:
                                            description: "`productRetailerPartNo`"
                                            type: string
                                          position:
                                            description: Item's position on the list of results
                                            type: integer
                                    promoteHitsPositionStrategy:
                                      oneOf:
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - manual
                                              example: manual
                                          required:
                                            - type
                                          additionalProperties: false
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - custom
                                              example: custom
                                          required:
                                            - type
                                          additionalProperties: false
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - ascending
                                              example: ascending
                                            start:
                                              type: integer
                                              example: 1
                                            step:
                                              type: integer
                                              example: 2
                                          required:
                                            - type
                                            - start
                                            - step
                                          additionalProperties: false
                                      discriminator:
                                        propertyName: type
                                        mapping:
                                          manual: "#/components/schemas/query-rules-v2-ManualType"
                                          custom: "#/components/schemas/query-rules-v2-CustomType"
                                          ascending: "#/components/schemas/query-rules-v2-AscendingType"
                                      example:
                                        type: custom
                                    standardFilters:
                                      type: object
                                      description: Filters for the query
                                      properties:
                                        textFilters:
                                          type: array
                                          description: Text-type filters
                                          items:
                                            type: object
                                            properties:
                                              attribute:
                                                type: string
                                                description: Attribute to be filtered
                                                example: brand
                                              mode:
                                                type: string
                                                description: |
                                                  Information whether to include or exclude filtered results.

                                                  - `include`: includes filtered results
                                                  - `exclude`: excludes filtered results
                                                enum:
                                                  - include
                                                  - exclude
                                                example: include
                                            oneOf:
                                              - properties:
                                                  values:
                                                    type: array
                                                    description: Values to be used during filtering. May contain both strings and patterns.
                                                    example:
                                                      - A-Brand
                                                      - B-Brand
                                                      - "{brand}"
                                                    items:
                                                      type: string
                                              - properties:
                                                  aggregateId:
                                                    type: string
                                                    description: Uuid of an aggregate to be used during filtering.
                                                    example: 32be9640-37e5-3196-abb6-6dc192002dab
                                              - properties:
                                                  expressionId:
                                                    type: string
                                                    description: Uuid of an expression to be used during filtering.
                                                    example: ad29ff7a-7148-4a5c-8a2a-4491e3ae7e9d
                                        rangeFilters:
                                          type: array
                                          description: Range-type filters
                                          items:
                                            type: object
                                            properties:
                                              attribute:
                                                type: string
                                                description: Attribute to be filtered
                                                example: price
                                              operator:
                                                type: string
                                                description: |
                                                  Operator to be used during filtering.

                                                  - `gt`: greater than
                                                  - `gte`: greater or equal
                                                  - `lt`: less than
                                                  - `lte`: less than or equal
                                                  - `eq`/`neq`: equal/not equal
                                                enum:
                                                  - gt
                                                  - gte
                                                  - lt
                                                  - lte
                                                  - eq
                                                  - neq
                                            oneOf:
                                              - properties:
                                                  value:
                                                    description: Value to use during filtering
                                                    oneOf:
                                                      - type: string
                                                        description: Placeholder value to use during filtering. The placeholder must be included in all of the patterns defined in the `conditions` object.
                                                        example: "{price}"
                                                      - type: number
                                                        format: float
                                                        description: Float value to use during filtering
                                                        example: 19.99
                                              - properties:
                                                  aggregateId:
                                                    type: string
                                                    description: Uuid of an aggregate to be used during filtering.
                                                    example: 32be9640-37e5-3196-abb6-6dc192002dab
                                              - properties:
                                                  expressionId:
                                                    type: string
                                                    description: Uuid of an expression to be used during filtering.
                                                    example: ad29ff7a-7148-4a5c-8a2a-4491e3ae7e
                                        datetimeFilters:
                                          type: array
                                          description: Range-type datetime filters
                                          items:
                                            type: object
                                            properties:
                                              attribute:
                                                type: string
                                                description: Attribute to be filtered
                                                example: created
                                              operator:
                                                type: string
                                                description: |
                                                  Operator to be used during filtering.

                                                  - `gt`: greater than
                                                  - `gte`: greater or equal
                                                  - `lt`: less than
                                                  - `lte`: less than or equal
                                                  - `eq`/`neq`: equal/not equal
                                                enum:
                                                  - gt
                                                  - gte
                                                  - lt
                                                  - lte
                                                  - eq
                                                  - neq
                                            oneOf:
                                              - properties:
                                                  value:
                                                    description: Value to use during filtering
                                                    oneOf:
                                                      - type: string
                                                        description: Placeholder value to use during filtering. The placeholder must be included in all of the patterns defined in the `conditions` object.
                                                        example: "{created}"
                                                      - type: string
                                                        description: ISO datetime value to use during filtering
                                                        example: 2024-01-01T00:00:00Z
                                              - properties:
                                                  aggregateId:
                                                    type: string
                                                    description: Uuid of an aggregate to be used during filtering.
                                                    example: 32be9640-37e5-3196-abb6-6dc192002dab
                                              - properties:
                                                  expressionId:
                                                    type: string
                                                    description: Uuid of an expression to be used during filtering.
                                                    example: ad29ff7a-7148-4a5c-8a2a-4491e3ae7e
                                              - properties:
                                                  relativeValue:
                                                    type: object
                                                    required:
                                                      - value
                                                      - unit
                                                    properties:
                                                      value:
                                                        type: integer
                                                        description: The numerical duration value.
                                                      unit:
                                                        type: string
                                                        description: The unit of duration.
                                                        enum:
                                                          - seconds
                                                          - minutes
                                                          - hours
                                                          - days
                                                    example:
                                                      value: 2
                                                      unit: days
                                    elasticFilters:
                                      type: object
                                      description: Filters for the query
                                      properties:
                                        textFilters:
                                          type: array
                                          description: Text-type filters
                                          items:
                                            type: object
                                            properties:
                                              attribute:
                                                type: string
                                                description: Attribute to be filtered
                                                example: brand
                                              mode:
                                                type: string
                                                description: |
                                                  Information whether to include or exclude filtered results.

                                                  - `include`: includes filtered results
                                                  - `exclude`: excludes filtered results
                                                enum:
                                                  - include
                                                  - exclude
                                                example: include
                                            oneOf:
                                              - properties:
                                                  values:
                                                    type: array
                                                    description: Values to be used during filtering. May contain both strings and patterns.
                                                    example:
                                                      - A-Brand
                                                      - B-Brand
                                                      - "{brand}"
                                                    items:
                                                      type: string
                                              - properties:
                                                  aggregateId:
                                                    type: string
                                                    description: Uuid of an aggregate to be used during filtering.
                                                    example: 32be9640-37e5-3196-abb6-6dc192002dab
                                              - properties:
                                                  expressionId:
                                                    type: string
                                                    description: Uuid of an expression to be used during filtering.
                                                    example: ad29ff7a-7148-4a5c-8a2a-4491e3ae7e9d
                                        rangeFilters:
                                          type: array
                                          description: Range-type filters
                                          items:
                                            type: object
                                            properties:
                                              attribute:
                                                type: string
                                                description: Attribute to be filtered
                                                example: price
                                              operator:
                                                type: string
                                                description: |
                                                  Operator to be used during filtering.

                                                  - `gt`: greater than
                                                  - `gte`: greater or equal
                                                  - `lt`: less than
                                                  - `lte`: less than or equal
                                                  - `eq`/`neq`: equal/not equal
                                                enum:
                                                  - gt
                                                  - gte
                                                  - lt
                                                  - lte
                                                  - eq
                                                  - neq
                                            oneOf:
                                              - properties:
                                                  value:
                                                    description: Value to use during filtering
                                                    oneOf:
                                                      - type: string
                                                        description: Placeholder value to use during filtering. The placeholder must be included in all of the patterns defined in the `conditions` object.
                                                        example: "{price}"
                                                      - type: number
                                                        format: float
                                                        description: Float value to use during filtering
                                                        example: 19.99
                                              - properties:
                                                  aggregateId:
                                                    type: string
                                                    description: Uuid of an aggregate to be used during filtering.
                                                    example: 32be9640-37e5-3196-abb6-6dc192002dab
                                              - properties:
                                                  expressionId:
                                                    type: string
                                                    description: Uuid of an expression to be used during filtering.
                                                    example: ad29ff7a-7148-4a5c-8a2a-4491e3ae7e
                                        datetimeFilters:
                                          type: array
                                          description: Range-type datetime filters
                                          items:
                                            type: object
                                            properties:
                                              attribute:
                                                type: string
                                                description: Attribute to be filtered
                                                example: created
                                              operator:
                                                type: string
                                                description: |
                                                  Operator to be used during filtering.

                                                  - `gt`: greater than
                                                  - `gte`: greater or equal
                                                  - `lt`: less than
                                                  - `lte`: less than or equal
                                                  - `eq`/`neq`: equal/not equal
                                                enum:
                                                  - gt
                                                  - gte
                                                  - lt
                                                  - lte
                                                  - eq
                                                  - neq
                                            oneOf:
                                              - properties:
                                                  value:
                                                    description: Value to use during filtering
                                                    oneOf:
                                                      - type: string
                                                        description: Placeholder value to use during filtering. The placeholder must be included in all of the patterns defined in the `conditions` object.
                                                        example: "{created}"
                                                      - type: string
                                                        description: ISO datetime value to use during filtering
                                                        example: 2024-01-01T00:00:00Z
                                              - properties:
                                                  aggregateId:
                                                    type: string
                                                    description: Uuid of an aggregate to be used during filtering.
                                                    example: 32be9640-37e5-3196-abb6-6dc192002dab
                                              - properties:
                                                  expressionId:
                                                    type: string
                                                    description: Uuid of an expression to be used during filtering.
                                                    example: ad29ff7a-7148-4a5c-8a2a-4491e3ae7e
                                              - properties:
                                                  relativeValue:
                                                    type: object
                                                    required:
                                                      - value
                                                      - unit
                                                    properties:
                                                      value:
                                                        type: integer
                                                        description: The numerical duration value.
                                                      unit:
                                                        type: string
                                                        description: The unit of duration.
                                                        enum:
                                                          - seconds
                                                          - minutes
                                                          - hours
                                                          - days
                                                    example:
                                                      value: 2
                                                      unit: days
                                    boostFilters:
                                      type: array
                                      description: Filters that boost the results
                                      items:
                                        type: object
                                        properties:
                                          weight:
                                            type: integer
                                            description: |
                                              The boost percentage. Positive values boost scores of results that match
                                              the provided filters. Negative values demotes scores of matching items.
                                            minimum: -100
                                            maximum: 100
                                            not:
                                              enum:
                                                - 0
                                          filters:
                                            type: object
                                            description: Filters for the query
                                            properties:
                                              textFilters:
                                                type: array
                                                description: Text-type filters
                                                items:
                                                  type: object
                                                  properties:
                                                    attribute:
                                                      type: string
                                                      description: Attribute to be filtered
                                                      example: brand
                                                    mode:
                                                      type: string
                                                      description: |
                                                        Information whether to include or exclude filtered results.

                                                        - `include`: includes filtered results
                                                        - `exclude`: excludes filtered results
                                                      enum:
                                                        - include
                                                        - exclude
                                                      example: include
                                                  oneOf:
                                                    - properties:
                                                        values:
                                                          type: array
                                                          description: Values to be used during filtering. May contain both strings and patterns.
                                                          example:
                                                            - A-Brand
                                                            - B-Brand
                                                            - "{brand}"
                                                          items:
                                                            type: string
                                                    - properties:
                                                        aggregateId:
                                                          type: string
                                                          description: Uuid of an aggregate to be used during filtering.
                                                          example: 32be9640-37e5-3196-abb6-6dc192002dab
                                                    - properties:
                                                        expressionId:
                                                          type: string
                                                          description: Uuid of an expression to be used during filtering.
                                                          example: ad29ff7a-7148-4a5c-8a2a-4491e3ae7e9d
                                              rangeFilters:
                                                type: array
                                                description: Range-type filters
                                                items:
                                                  type: object
                                                  properties:
                                                    attribute:
                                                      type: string
                                                      description: Attribute to be filtered
                                                      example: price
                                                    operator:
                                                      type: string
                                                      description: |
                                                        Operator to be used during filtering.

                                                        - `gt`: greater than
                                                        - `gte`: greater or equal
                                                        - `lt`: less than
                                                        - `lte`: less than or equal
                                                        - `eq`/`neq`: equal/not equal
                                                      enum:
                                                        - gt
                                                        - gte
                                                        - lt
                                                        - lte
                                                        - eq
                                                        - neq
                                                  oneOf:
                                                    - properties:
                                                        value:
                                                          description: Value to use during filtering
                                                          oneOf:
                                                            - type: string
                                                              description: Placeholder value to use during filtering. The placeholder must be included in all of the patterns defined in the `conditions` object.
                                                              example: "{price}"
                                                            - type: number
                                                              format: float
                                                              description: Float value to use during filtering
                                                              example: 19.99
                                                    - properties:
                                                        aggregateId:
                                                          type: string
                                                          description: Uuid of an aggregate to be used during filtering.
                                                          example: 32be9640-37e5-3196-abb6-6dc192002dab
                                                    - properties:
                                                        expressionId:
                                                          type: string
                                                          description: Uuid of an expression to be used during filtering.
                                                          example: ad29ff7a-7148-4a5c-8a2a-4491e3ae7e
                                              datetimeFilters:
                                                type: array
                                                description: Range-type datetime filters
                                                items:
                                                  type: object
                                                  properties:
                                                    attribute:
                                                      type: string
                                                      description: Attribute to be filtered
                                                      example: created
                                                    operator:
                                                      type: string
                                                      description: |
                                                        Operator to be used during filtering.

                                                        - `gt`: greater than
                                                        - `gte`: greater or equal
                                                        - `lt`: less than
                                                        - `lte`: less than or equal
                                                        - `eq`/`neq`: equal/not equal
                                                      enum:
                                                        - gt
                                                        - gte
                                                        - lt
                                                        - lte
                                                        - eq
                                                        - neq
                                                  oneOf:
                                                    - properties:
                                                        value:
                                                          description: Value to use during filtering
                                                          oneOf:
                                                            - type: string
                                                              description: Placeholder value to use during filtering. The placeholder must be included in all of the patterns defined in the `conditions` object.
                                                              example: "{created}"
                                                            - type: string
                                                              description: ISO datetime value to use during filtering
                                                              example: 2024-01-01T00:00:00Z
                                                    - properties:
                                                        aggregateId:
                                                          type: string
                                                          description: Uuid of an aggregate to be used during filtering.
                                                          example: 32be9640-37e5-3196-abb6-6dc192002dab
                                                    - properties:
                                                        expressionId:
                                                          type: string
                                                          description: Uuid of an expression to be used during filtering.
                                                          example: ad29ff7a-7148-4a5c-8a2a-4491e3ae7e
                                                    - properties:
                                                        relativeValue:
                                                          type: object
                                                          required:
                                                            - value
                                                            - unit
                                                          properties:
                                                            value:
                                                              type: integer
                                                              description: The numerical duration value.
                                                            unit:
                                                              type: string
                                                              description: The unit of duration.
                                                              enum:
                                                                - seconds
                                                                - minutes
                                                                - hours
                                                                - days
                                                          example:
                                                            value: 2
                                                            unit: days
                                    topHitsFilters:
                                      type: array
                                      description: Filters that move a specified number of items to the front
                                      items:
                                        type: object
                                        properties:
                                          hitsNumber:
                                            type: integer
                                            description: |
                                              Number of top-scoring items that match the provided filters
                                              and will be moved to the front of the results
                                            minimum: 1
                                            maximum: 20
                                          positions:
                                            type: array
                                            description: |
                                              Optional 1-based result positions for the top-hits, aligned by index to the sub-query's score order. Omit for the default front-block-by-score behaviour. Must be unique, within [1, 50], and no more than `hitsNumber` entries.
                                            items:
                                              type: integer
                                              minimum: 1
                                              maximum: 50
                                          filters:
                                            type: object
                                            description: Filters for the query
                                            properties:
                                              textFilters:
                                                type: array
                                                description: Text-type filters
                                                items:
                                                  type: object
                                                  properties:
                                                    attribute:
                                                      type: string
                                                      description: Attribute to be filtered
                                                      example: brand
                                                    mode:
                                                      type: string
                                                      description: |
                                                        Information whether to include or exclude filtered results.

                                                        - `include`: includes filtered results
                                                        - `exclude`: excludes filtered results
                                                      enum:
                                                        - include
                                                        - exclude
                                                      example: include
                                                  oneOf:
                                                    - properties:
                                                        values:
                                                          type: array
                                                          description: Values to be used during filtering. May contain both strings and patterns.
                                                          example:
                                                            - A-Brand
                                                            - B-Brand
                                                            - "{brand}"
                                                          items:
                                                            type: string
                                                    - properties:
                                                        aggregateId:
                                                          type: string
                                                          description: Uuid of an aggregate to be used during filtering.
                                                          example: 32be9640-37e5-3196-abb6-6dc192002dab
                                                    - properties:
                                                        expressionId:
                                                          type: string
                                                          description: Uuid of an expression to be used during filtering.
                                                          example: ad29ff7a-7148-4a5c-8a2a-4491e3ae7e9d
                                              rangeFilters:
                                                type: array
                                                description: Range-type filters
                                                items:
                                                  type: object
                                                  properties:
                                                    attribute:
                                                      type: string
                                                      description: Attribute to be filtered
                                                      example: price
                                                    operator:
                                                      type: string
                                                      description: |
                                                        Operator to be used during filtering.

                                                        - `gt`: greater than
                                                        - `gte`: greater or equal
                                                        - `lt`: less than
                                                        - `lte`: less than or equal
                                                        - `eq`/`neq`: equal/not equal
                                                      enum:
                                                        - gt
                                                        - gte
                                                        - lt
                                                        - lte
                                                        - eq
                                                        - neq
                                                  oneOf:
                                                    - properties:
                                                        value:
                                                          description: Value to use during filtering
                                                          oneOf:
                                                            - type: string
                                                              description: Placeholder value to use during filtering. The placeholder must be included in all of the patterns defined in the `conditions` object.
                                                              example: "{price}"
                                                            - type: number
                                                              format: float
                                                              description: Float value to use during filtering
                                                              example: 19.99
                                                    - properties:
                                                        aggregateId:
                                                          type: string
                                                          description: Uuid of an aggregate to be used during filtering.
                                                          example: 32be9640-37e5-3196-abb6-6dc192002dab
                                                    - properties:
                                                        expressionId:
                                                          type: string
                                                          description: Uuid of an expression to be used during filtering.
                                                          example: ad29ff7a-7148-4a5c-8a2a-4491e3ae7e
                                              datetimeFilters:
                                                type: array
                                                description: Range-type datetime filters
                                                items:
                                                  type: object
                                                  properties:
                                                    attribute:
                                                      type: string
                                                      description: Attribute to be filtered
                                                      example: created
                                                    operator:
                                                      type: string
                                                      description: |
                                                        Operator to be used during filtering.

                                                        - `gt`: greater than
                                                        - `gte`: greater or equal
                                                        - `lt`: less than
                                                        - `lte`: less than or equal
                                                        - `eq`/`neq`: equal/not equal
                                                      enum:
                                                        - gt
                                                        - gte
                                                        - lt
                                                        - lte
                                                        - eq
                                                        - neq
                                                  oneOf:
                                                    - properties:
                                                        value:
                                                          description: Value to use during filtering
                                                          oneOf:
                                                            - type: string
                                                              description: Placeholder value to use during filtering. The placeholder must be included in all of the patterns defined in the `conditions` object.
                                                              example: "{created}"
                                                            - type: string
                                                              description: ISO datetime value to use during filtering
                                                              example: 2024-01-01T00:00:00Z
                                                    - properties:
                                                        aggregateId:
                                                          type: string
                                                          description: Uuid of an aggregate to be used during filtering.
                                                          example: 32be9640-37e5-3196-abb6-6dc192002dab
                                                    - properties:
                                                        expressionId:
                                                          type: string
                                                          description: Uuid of an expression to be used during filtering.
                                                          example: ad29ff7a-7148-4a5c-8a2a-4491e3ae7e
                                                    - properties:
                                                        relativeValue:
                                                          type: object
                                                          required:
                                                            - value
                                                            - unit
                                                          properties:
                                                            value:
                                                              type: integer
                                                              description: The numerical duration value.
                                                            unit:
                                                              type: string
                                                              description: The unit of duration.
                                                              enum:
                                                                - seconds
                                                                - minutes
                                                                - hours
                                                                - days
                                                          example:
                                                            value: 2
                                                            unit: days
                                    distinctFilter:
                                      type: object
                                      required:
                                        - attribute
                                        - maxNumItems
                                      description: Distinct filter definition
                                      properties:
                                        attribute:
                                          type: string
                                          description: Name of the attribute for distinct filter
                                        maxNumItems:
                                          type: integer
                                          description: Max number of items having the same attribute value
                                        categoryLevelModifier:
                                          type: integer
                                          description: Category level modifier to use with `category` attribute
                                    sortBy:
                                      type: object
                                      description: Sorting info
                                      properties:
                                        attribute:
                                          type: string
                                          description: Name of the attribute by which the data will be sorted
                                        ordering:
                                          description: Sorting order
                                          type: string
                                          enum:
                                            - desc
                                            - asc
                                    customData:
                                      type: string
                                      description: Custom JSON that will be returned with the search results
                                      example: '{"customLandingPage": "https://synerise.com/"}'
                                    returnNoData:
                                      type: boolean
                                      description: When set to `true`, forces the search result to be empty
                                      example: false
                                    pinFacets:
                                      type: array
                                      description: |
                                        Forces specific facets to be included in the response, regardless of coverage score or
                                        automatic facet selection. Each entry may optionally specify a 1-based `position` to pin
                                        the facet at a specific slot in the response `facetsOrdering`.

                                        A pin without `position` is placed before any non-pinned facets (in input order).
                                        A pin with `position` greater than the final list size is appended at the tail; multiple
                                        such pins keep their relative ordering by ascending `position`.
                                        A facet that is also `hideFacets` is dropped (hide wins).
                                        A pin's attribute must exist in the index's facetable attributes; positions cannot exceed
                                        the number of facetable attributes.
                                      items:
                                        type: object
                                        required:
                                          - attribute
                                        properties:
                                          attribute:
                                            type: string
                                            description: Name of the facet attribute to pin.
                                            example: size
                                          position:
                                            type: integer
                                            minimum: 1
                                            maximum: 100
                                            description: |
                                              Optional 1-based slot in `facetsOrdering`. Omit to pin without specifying a slot.
                                            example: 1
                                      example:
                                        - attribute: size
                                          position: 1
                                        - attribute: width
                                          position: 2
                                        - attribute: gift_wrap
                                    hideFacets:
                                      type: array
                                      description: |
                                        Forces specific facets to be excluded from the response, even if they would otherwise be
                                        selected by automatic facet selection or were explicitly requested by the API caller.
                                        Hidden attributes are also stripped from `customFilteredFacets` for the matched request.
                                      items:
                                        type: string
                                        description: Facet attribute to hide.
                                      example:
                                        - material
                                        - fabric
                                        - sleeve_length
                                    scoringOverride:
                                      oneOf:
                                        - type: object
                                          required:
                                            - type
                                            - weights
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - ranking
                                            weights:
                                              type: object
                                              description: |
                                                Absolute per-signal ranking weights. Each supplied signal overrides the index-config value; omitted signals fall back to index config. At least one signal must be set.
                                              properties:
                                                personalized:
                                                  type: number
                                                  minimum: 0
                                                  maximum: 5
                                                pageVisitsPopularity:
                                                  type: number
                                                  minimum: 0
                                                  maximum: 5
                                                transactionsPopularity:
                                                  type: number
                                                  minimum: 0
                                                  maximum: 5
                                                pageVisits7DaysPopularity:
                                                  type: number
                                                  minimum: 0
                                                  maximum: 5
                                                transactions7DaysPopularity:
                                                  type: number
                                                  minimum: 0
                                                  maximum: 5
                                                revenueBoost:
                                                  type: number
                                                  minimum: 0
                                                  maximum: 5
                                                conversionRateBoost:
                                                  type: number
                                                  minimum: 0
                                                  maximum: 5
                                        - type: object
                                          required:
                                            - type
                                            - optimizationTarget
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - target
                                            optimizationTarget:
                                              type: string
                                              enum:
                                                - ctr
                                                - cr
                                                - revenue
                                                - ndcg
                                                - margin
                                      discriminator:
                                        propertyName: type
                            source:
                              type: string
                              description: Whether the rule belongs to the index itself (`index`) or is inherited from its parent index (`parent`). Inherited rules are read-only on the child index.
                              enum:
                                - index
                                - parent
                  extras:
                    type: object
                    description: Additional information
                    properties:
                      statuses:
                        type: object
                        description: The number of rules with each status. All rules are considered.
                        properties:
                          Finished:
                            type: integer
                          Draft:
                            type: integer
                          Paused:
                            type: integer
                          Scheduled:
                            type: integer
                          Active:
                            type: integer
                  meta:
                    type: object
                    description: 'Optional pagination metadata (sent if `"includeMeta": true`)'
                    properties:
                      totalPages:
                        type: number
                        description: The total number of pages
                      totalCount:
                        type: number
                        description: The total number of campaigns
                      page:
                        type: number
                        description: The current page
                      limit:
                        type: number
                        description: The maximal number of items on a page
                      sortedBy:
                        type: string
                        description: The column (attribute) that the campaigns were sorted by
                      ordering:
                        type: string
                        description: Sorting order
                      code:
                        type: number
                        description: HTTP response code
                      link:
                        type: array
                        description: Links to neighboring pages, first page, and last page in pagination
                        items:
                          type: object
                          properties:
                            url:
                              description: Page URL
                              type: string
                            rel:
                              type: string
                              description: Position of the linked page
                              enum:
                                - first
                                - next
                                - prev
                                - last
        "500":
          description: An error occurred
          content:
            application/json:
              schema:
                type: object
                properties:
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the error occurred
                  status:
                    type: integer
                    description: Status code
                  error:
                    type: string
                    description: Summary of the error
                  message:
                    type: string
                    description: Description of the problem
                  path:
                    type: string
                    description: URL of the requested resource
                required:
                  - timestamp
                  - status
                  - message
      x-snr-doc-urls:
        - /api-reference/ai-search#tag/Query-Rules/operation/GetRulesV2
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request GET \
              --url 'https://api.synerise.com/search/v2/indices/%7BindexId%7D/rules?status=SOME_STRING_VALUE&name=SOME_STRING_VALUE&page=4&limit=100&sortBy=SOME_STRING_VALUE&ordering=SOME_STRING_VALUE&includeMeta=SOME_BOOLEAN_VALUE&directoryId=SOME_STRING_VALUE&search=SOME_STRING_VALUE&consequenceType=SOME_ARRAY_VALUE' \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'
        - lang: Python
          label: Python
          source: |-
            import http.client

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

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

            conn.request("GET", "/search/v2/indices/%7BindexId%7D/rules?status=SOME_STRING_VALUE&name=SOME_STRING_VALUE&page=4&limit=100&sortBy=SOME_STRING_VALUE&ordering=SOME_STRING_VALUE&includeMeta=SOME_BOOLEAN_VALUE&directoryId=SOME_STRING_VALUE&search=SOME_STRING_VALUE&consequenceType=SOME_ARRAY_VALUE", headers=headers)

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

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

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

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

            xhr.open("GET", "https://api.synerise.com/search/v2/indices/%7BindexId%7D/rules?status=SOME_STRING_VALUE&name=SOME_STRING_VALUE&page=4&limit=100&sortBy=SOME_STRING_VALUE&ordering=SOME_STRING_VALUE&includeMeta=SOME_BOOLEAN_VALUE&directoryId=SOME_STRING_VALUE&search=SOME_STRING_VALUE&consequenceType=SOME_ARRAY_VALUE");
            xhr.setRequestHeader("Authorization", "Bearer REPLACE_BEARER_TOKEN");

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

            const options = {
              "method": "GET",
              "hostname": "api.synerise.com",
              "port": null,
              "path": "/search/v2/indices/%7BindexId%7D/rules?status=SOME_STRING_VALUE&name=SOME_STRING_VALUE&page=4&limit=100&sortBy=SOME_STRING_VALUE&ordering=SOME_STRING_VALUE&includeMeta=SOME_BOOLEAN_VALUE&directoryId=SOME_STRING_VALUE&search=SOME_STRING_VALUE&consequenceType=SOME_ARRAY_VALUE",
              "headers": {
                "Authorization": "Bearer REPLACE_BEARER_TOKEN"
              }
            };

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

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

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

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

            $request = new HttpRequest();
            $request->setUrl('https://api.synerise.com/search/v2/indices/%7BindexId%7D/rules');
            $request->setMethod(HTTP_METH_GET);

            $request->setQueryData([
              'status' => 'SOME_STRING_VALUE',
              'name' => 'SOME_STRING_VALUE',
              'page' => '4',
              'limit' => '100',
              'sortBy' => 'SOME_STRING_VALUE',
              'ordering' => 'SOME_STRING_VALUE',
              'includeMeta' => 'SOME_BOOLEAN_VALUE',
              'directoryId' => 'SOME_STRING_VALUE',
              'search' => 'SOME_STRING_VALUE',
              'consequenceType' => 'SOME_ARRAY_VALUE'
            ]);

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

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

              echo $response->getBody();
            } catch (HttpException $ex) {
              echo $ex;
            }
        - lang: Java
          label: Java
          source: |-
            HttpResponse<String> response = Unirest.get("https://api.synerise.com/search/v2/indices/%7BindexId%7D/rules?status=SOME_STRING_VALUE&name=SOME_STRING_VALUE&page=4&limit=100&sortBy=SOME_STRING_VALUE&ordering=SOME_STRING_VALUE&includeMeta=SOME_BOOLEAN_VALUE&directoryId=SOME_STRING_VALUE&search=SOME_STRING_VALUE&consequenceType=SOME_ARRAY_VALUE")
              .header("Authorization", "Bearer REPLACE_BEARER_TOKEN")
              .asString();
servers:
  - description: Microsoft Azure EU
    url: https://api.synerise.com
  - description: Microsoft Azure USA
    url: https://api.azu.synerise.com
  - description: Google Cloud Platform
    url: https://api.geb.synerise.com
tags:
  - name: Query Rules
components:
  securitySchemes:
    JWT:
      type: http
      scheme: bearer
      description: |-
        JWT Bearer token. The header looks like this: `Bearer {JWT}`

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

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