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

# List query rewrites

> Note that sorting applies to the rule's staging content only. Filtering applies OR logic, so it matches if either the staging or live content matches the filter. Use `textSearchRelevance` sort to sort by search relevance (cannot be combined with other sort parameters).



## OpenAPI

````yaml /api-reference/saas/cs-rules-rewrites.json get /query-rewrites
openapi: 3.0.3
info:
  title: Rules & Rewrites API
  description: >-
    Manage Commerce Studio rules and query rewrites. Rules control search result
    behavior including boosting, burying, pinning, redirects, banners, and facet
    configuration. Query rewrites handle synonym expansion, misspelling
    correction, phrase matching, and query term manipulation.


    The endpoints require an authentication token with scope
    `commercestudio.rules` for rule operations and `commercestudio.rewrites` for
    query rewrite operations.
  version: 1.0.0
  contact:
    name: Lucidworks
    url: https://lucidworks.com/
    email: support@lucidworks.com
servers:
  - url: https://{commerce_studio_id}.experiencemanager.lucidworks.com
    description: Production.
    variables:
      commerce_studio_id:
        default: commerce_studio_id
        description: The ID of your Commerce Studio instance.
security:
  - authToken: []
tags:
  - name: Rule Management
    description: Create/Read/Update/Delete (CRUD) operations for Commerce Studio rules.
  - name: Query Rewrite Management
    description: >-
      Create/Read/Update/Delete (CRUD) operations for Commerce Studio query
      rewrites.
paths:
  /query-rewrites:
    get:
      tags:
        - Query Rewrite Management
      summary: List query rewrites
      description: >-
        Note that sorting applies to the rule's staging content only. Filtering
        applies OR logic, so it matches if either the staging or live content
        matches the filter. Use `textSearchRelevance` sort to sort by search
        relevance (cannot be combined with other sort parameters).
      operationId: listQueryRewrites
      parameters:
        - name: searchQuery
          in: query
          required: false
          schema:
            type: string
          description: Search query for text-based search.
        - name: types
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
            uniqueItems: true
          description: Types of query rewrites to filter by (OR logic).
        - name: published
          in: query
          required: false
          schema:
            type: boolean
          description: Filter by published status.
        - name: myRewrites
          in: query
          required: false
          schema:
            type: boolean
          description: Filter to show only rewrites created by the authenticated user.
        - name: createdBy
          in: query
          required: false
          schema:
            type: string
          description: Filter by the username of the creator.
        - name: createdStart
          in: query
          required: false
          schema:
            type: string
            format: date-time
          description: Filter by creation date start (ISO 8601 date-time).
        - name: createdEnd
          in: query
          required: false
          schema:
            type: string
            format: date-time
          description: Filter by creation date end (ISO 8601 date-time).
        - name: contentType
          in: query
          required: false
          schema:
            type: string
            enum:
              - RULE
              - QUERY_REWRITE
          description: Filter by content type.
        - name: page
          in: query
          required: false
          schema:
            type: integer
            format: int32
            minimum: 0
            default: 0
          description: Page number for pagination (zero-indexed).
        - name: size
          in: query
          required: false
          schema:
            type: integer
            format: int32
            minimum: 1
            default: 20
          description: Number of items per page.
        - name: sort
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
          description: >-
            Sort order in the format `property,direction` (e.g.,
            `createdDate,desc`). Can specify multiple sort parameters.
        - name: fields
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
              enum:
                - FUSION_SYNC_STATUS
                - MIGRATION
          description: >-
            Optional additional fields to include in the response. Keep in mind
            that additional fields can slow the call and increase the response
            size.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PagedModelQueryRewriteSummary'
              example:
                queryRewriteCounts: {}
                content:
                  - type: SYNONYM
                    id: 6ba7b810-9dad-11d1-80b4-00c04fd430c8
                    createdBy: user@example.com
                    creationDate: '2026-01-20T10:15:00Z'
                    lastModifiedBy: user@example.com
                    lastModified: '2026-01-20T10:15:00Z'
                    name: Laptop synonyms
                    published: true
                    markedForDeletion: false
                    deleted: false
                    description: Expand laptop queries with synonyms
                    matchType: EXACT
                    input: laptop
                    output:
                      - laptop
                      - notebook
                      - portable computer
                page:
                  size: 10
                  number: 0
                  totalElements: 1
                  totalPages: 1
components:
  schemas:
    PagedModelQueryRewriteSummary:
      type: object
      properties:
        content:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/HeadTailQueryRewriteSummary'
              - $ref: '#/components/schemas/MisspellingQueryRewriteSummary'
              - $ref: '#/components/schemas/PhraseQueryRewriteSummary'
              - $ref: '#/components/schemas/RemoveWordsQueryRewriteSummary'
              - $ref: '#/components/schemas/SynonymQueryRewriteSummary'
        page:
          $ref: '#/components/schemas/PageMetadata'
      title: PagedModelQueryRewriteSummary
    HeadTailQueryRewriteSummary:
      title: HeadTailQueryRewriteSummary
      type: object
      properties:
        id:
          type: string
          description: Entity ID.
          format: uuid
        createdBy:
          type: string
          description: User who created the entity.
        creationDate:
          type: string
          description: Date when the entity was created.
          format: date-time
        lastModifiedBy:
          type: string
          description: User who last updated the entity.
        lastModified:
          type: string
          description: Date when the entity was last updated.
          format: date-time
        published:
          type: boolean
          description: Whether the rewrite is staged or published.
        version:
          type: string
          description: >-
            The version of this rewrite for synchronization purposes. Not the
            same as `lastModified`, and not used for `If-Match` in the API.
          format: date-time
        stagingFusionSyncStatus:
          $ref: '#/components/schemas/FusionSyncStatusV2Summary'
        liveFusionSyncStatus:
          $ref: '#/components/schemas/FusionSyncStatusV2Summary'
        markedForDeletion:
          type: boolean
          description: >-
            `True` if this rewrite is marked for deletion but has not yet been
            fully removed from the system. This should only show up as `true` in
            rare cases. The system is supposed to resolve this situation
            eventually. Rewrites in this state (`true`) should not show up in
            the listing endpoints (other than `GET` by ID) unless explicitly
            requested to be included. Intended for troubleshooting purposes.
        description:
          type: string
          description: Rewrite description.
        externalId:
          type: string
          description: >-
            An optional ID set by external users of the API at creation time.
            Cannot be changed after creation.
        migratedId:
          type: string
          description: >-
            If this was originally migrated from another system, this field
            shows the ID of the original rewrite.
        type:
          type: string
          description: Query rewrite type. Determines which schema applies.
          enum:
            - HEAD_TAIL
        surfaceForm:
          type: string
          description: The underperforming query to replace.
        outputs:
          type: array
          description: >-
            Query phrases that produce higher click-through rates to replace the
            underperforming query.
          items:
            type: string
      description: >-
        Replace underperforming queries with queries that produce higher
        click-through rates.
      required:
        - type
    MisspellingQueryRewriteSummary:
      title: MisspellingQueryRewriteSummary
      type: object
      properties:
        id:
          type: string
          description: Entity ID.
          format: uuid
        createdBy:
          type: string
          description: User who created the entity.
        creationDate:
          type: string
          description: Date when the entity was created.
          format: date-time
        lastModifiedBy:
          type: string
          description: User who last updated the entity.
        lastModified:
          type: string
          description: Date when the entity was last updated.
          format: date-time
        published:
          type: boolean
          description: Whether the rewrite is staged or published.
        version:
          type: string
          description: >-
            The version of this rewrite for synchronization purposes. Not the
            same as `lastModified`, and not used for `If-Match` in the API.
          format: date-time
        stagingFusionSyncStatus:
          $ref: '#/components/schemas/FusionSyncStatusV2Summary'
        liveFusionSyncStatus:
          $ref: '#/components/schemas/FusionSyncStatusV2Summary'
        markedForDeletion:
          type: boolean
          description: >-
            `True` if this rewrite is marked for deletion but has not yet been
            fully removed from the system. This should only show up as `true` in
            rare cases. The system is supposed to resolve this situation
            eventually. Rewrites in this state (`true`) should not show up in
            the listing endpoints (other than `GET` by ID) unless explicitly
            requested to be included. Intended for troubleshooting purposes.
        description:
          type: string
          description: Rewrite description.
        externalId:
          type: string
          description: >-
            An optional ID set by external users of the API at creation time.
            Cannot be changed after creation.
        migratedId:
          type: string
          description: >-
            If this was originally migrated from another system, this field
            shows the ID of the original rewrite.
        type:
          type: string
          description: Query rewrite type. Determines which schema applies.
          enum:
            - MISSPELLING
        surfaceForm:
          type: string
          description: The misspelled query term to correct.
        outputs:
          type: array
          description: Correct spellings of the query term.
          items:
            type: string
      description: >-
        Replace misspelled query terms with their spelling corrections for
        better search results.
      required:
        - type
    PhraseQueryRewriteSummary:
      title: PhraseQueryRewriteSummary
      type: object
      properties:
        id:
          type: string
          description: Entity ID.
          format: uuid
        createdBy:
          type: string
          description: User who created the entity.
        creationDate:
          type: string
          description: Date when the entity was created.
          format: date-time
        lastModifiedBy:
          type: string
          description: User who last updated the entity.
        lastModified:
          type: string
          description: Date when the entity was last updated.
          format: date-time
        published:
          type: boolean
          description: Whether the rewrite is staged or published.
        version:
          type: string
          description: >-
            The version of this rewrite for synchronization purposes. Not the
            same as `lastModified`, and not used for `If-Match` in the API.
          format: date-time
        stagingFusionSyncStatus:
          $ref: '#/components/schemas/FusionSyncStatusV2Summary'
        liveFusionSyncStatus:
          $ref: '#/components/schemas/FusionSyncStatusV2Summary'
        markedForDeletion:
          type: boolean
          description: >-
            `True` if this rewrite is marked for deletion but has not yet been
            fully removed from the system. This should only show up as `true` in
            rare cases. The system is supposed to resolve this situation
            eventually. Rewrites in this state (`true`) should not show up in
            the listing endpoints (other than `GET` by ID) unless explicitly
            requested to be included. Intended for troubleshooting purposes.
        description:
          type: string
          description: Rewrite description.
        externalId:
          type: string
          description: >-
            An optional ID set by external users of the API at creation time.
            Cannot be changed after creation.
        migratedId:
          type: string
          description: >-
            If this was originally migrated from another system, this field
            shows the ID of the original rewrite.
        type:
          type: string
          description: Query rewrite type. Determines which schema applies.
          enum:
            - PHRASE
        surfaceForm:
          type: string
          description: The phrase to boost when detected in queries.
        wordCount:
          type: integer
          description: >-
            Number of words in the phrase. This is only a very basic
            whitespace-delimited token count.
          format: int32
      description: >-
        Known phrases are boosted when they appear in new queries. The
        `surfaceForm` indicates the phrase to boost.
      required:
        - type
    RemoveWordsQueryRewriteSummary:
      title: RemoveWordsQueryRewriteSummary
      type: object
      properties:
        id:
          type: string
          description: Entity ID.
          format: uuid
        createdBy:
          type: string
          description: User who created the entity.
        creationDate:
          type: string
          description: Date when the entity was created.
          format: date-time
        lastModifiedBy:
          type: string
          description: User who last updated the entity.
        lastModified:
          type: string
          description: Date when the entity was last updated.
          format: date-time
        published:
          type: boolean
          description: Whether the rewrite is staged or published.
        version:
          type: string
          description: >-
            The version of this rewrite for synchronization purposes. Not the
            same as `lastModified`, and not used for `If-Match` in the API.
          format: date-time
        stagingFusionSyncStatus:
          $ref: '#/components/schemas/FusionSyncStatusV2Summary'
        liveFusionSyncStatus:
          $ref: '#/components/schemas/FusionSyncStatusV2Summary'
        markedForDeletion:
          type: boolean
          description: >-
            `True` if this rewrite is marked for deletion but has not yet been
            fully removed from the system. This should only show up as `true` in
            rare cases. The system is supposed to resolve this situation
            eventually. Rewrites in this state (`true`) should not show up in
            the listing endpoints (other than `GET` by ID) unless explicitly
            requested to be included. Intended for troubleshooting purposes.
        description:
          type: string
          description: Rewrite description.
        externalId:
          type: string
          description: >-
            An optional ID set by external users of the API at creation time.
            Cannot be changed after creation.
        migratedId:
          type: string
          description: >-
            If this was originally migrated from another system, this field
            shows the ID of the original rewrite.
        type:
          type: string
          description: Query rewrite type. Determines which schema applies.
          enum:
            - REMOVE_WORDS
        surfaceForm:
          type: string
          description: The word or phrase to remove from the query.
        triggerPhrases:
          type: array
          description: >-
            The surface form to remove will be removed from the query when the
            query also contains any of these phrases.
          items:
            type: string
      description: >-
        Used to remove particular phrases from searches containing specified
        phrases.
      required:
        - type
    SynonymQueryRewriteSummary:
      title: SynonymQueryRewriteSummary
      type: object
      properties:
        id:
          type: string
          description: Entity ID.
          format: uuid
        createdBy:
          type: string
          description: User who created the entity.
        creationDate:
          type: string
          description: Date when the entity was created.
          format: date-time
        lastModifiedBy:
          type: string
          description: User who last updated the entity.
        lastModified:
          type: string
          description: Date when the entity was last updated.
          format: date-time
        published:
          type: boolean
          description: Whether the rewrite is staged or published.
        version:
          type: string
          description: >-
            The version of this rewrite for synchronization purposes. Not the
            same as `lastModified`, and not used for `If-Match` in the API.
          format: date-time
        stagingFusionSyncStatus:
          $ref: '#/components/schemas/FusionSyncStatusV2Summary'
        liveFusionSyncStatus:
          $ref: '#/components/schemas/FusionSyncStatusV2Summary'
        markedForDeletion:
          type: boolean
          description: >-
            `True` if this rewrite is marked for deletion but has not yet been
            fully removed from the system. This should only show up as `true` in
            rare cases. The system is supposed to resolve this situation
            eventually. Rewrites in this state (`true`) should not show up in
            the listing endpoints (other than `GET` by ID) unless explicitly
            requested to be included. Intended for troubleshooting purposes.
        description:
          type: string
          description: Rewrite description.
        externalId:
          type: string
          description: >-
            An optional ID set by external users of the API at creation time.
            Cannot be changed after creation.
        migratedId:
          type: string
          description: >-
            If this was originally migrated from another system, this field
            shows the ID of the original rewrite.
        type:
          type: string
          description: Query rewrite type. Determines which schema applies.
          enum:
            - SYNONYM
        surfaceForm:
          type: string
          description: The query term to expand with synonyms.
        outputs:
          type: array
          description: Synonym terms that should expand the query.
          items:
            type: string
        direction:
          type: string
          description: >-
            `ONEWAY` means that if the surface form is present in the query, the
            query will be expanded, replacing the surface form with each output
            in the expansion. `SYMMETRIC` means this is also done for any output
            detected in a given query; the query is expanded and the output is
            replaced with the surface form in the expansion.
          enum:
            - ONEWAY
            - SYMMETRIC
      description: >-
        Synonyms are used to expand queries so that they include all known
        synonyms of the query terms.
      required:
        - type
    PageMetadata:
      type: object
      properties:
        size:
          type: integer
          description: Number of items per page.
          format: int64
        number:
          type: integer
          description: Current page number (0-indexed).
          format: int64
        totalElements:
          type: integer
          description: Total number of items across all pages.
          format: int64
        totalPages:
          type: integer
          description: Total number of pages.
          format: int64
      title: PageMetadata
    FusionSyncStatusV2Summary:
      type: object
      properties:
        lastSyncedVersion:
          type: string
          description: Version of this content that was last successfully synced.
          format: date-time
        fusionVersion:
          type: string
          description: >-
            Version received when the last successful sync was performed.

            This value comes from the underlying search engine's optimistic
            concurrency mechanism.
      description: Status of this content's synchronization.
      title: FusionSyncStatusV2Summary
  securitySchemes:
    authToken:
      type: http
      scheme: bearer

````