> ## 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.

# Update a query rewrite rule

> Creates or updates a query rewrite rule in the Experience Manager.



## OpenAPI

````yaml /api-reference/5.9/fusion-api-query.json post /experience-manager/query-rewrites
openapi: 3.0.1
info:
  title: Fusion Query API
  description: >-
    A Lucidworks Fusion microservice for machine-learning-enhanced ranking and
    retrieval.
  contact:
    name: Lucidworks
    url: www.lucidworks.com
    email: support@lucidworks.com
  license:
    name: License of API
    url: https://lucidworks.com/legal/developer-license-agreement/
  version: '5.9'
servers:
  - url: https://{FUSION HOST}/api
    description: Fusion
    variables:
      FUSION HOST:
        default: FUSION_HOST
        description: Your environment host.
  - url: https://{FUSION HOST}/api/apps/{APP_NAME}
    description: Fusion app
    variables:
      FUSION HOST:
        default: FUSION_HOST
        description: Your environment host.
      APP_NAME:
        default: APP_NAME
        description: The name of your Fusion app.
security:
  - Basic auth: []
  - API key: []
tags:
  - name: Custom Rule Type API
    description: Endpoints to define and manage custom rule type definitions.
  - name: Experiments API
    description: >-
      Use the Experiments API to compare different configuration variants and
      determine which ones are most successful.
  - name: Query Pipelines API
    description: >-
      Use these endpoints to view and manage your query pipelines.  You can also
      send queries using this API, though the Query Profiles API is recommended
      instead.
  - name: Query Profiles API
    description: >-
      The Query Profiles API provides static endpoints that you can consistently
      point to when querying your collections.  Query profiles allow you to
      change the query pipelines or collections behind them without changing the
      endpoint you use for your search queries.  See the Query Profiles CRUD API
      for endpoints that create and modify query profiles.
  - name: Query Profiles CRUD API
    description: >-
      Use these endpoints to create and modify query profiles.  Query profiles
      allow you to change the query pipelines or collections behind them without
      changing the endpoint you use for your search queries.  See the Query
      Profiles API for the query endpoints.
  - name: Query Rewrite API
    description: >-
      The Query Rewrite API manages documents used for query rewriting to
      improve relevancy using AI-generated data. Primarily for internal use.
  - name: Query Stage API
    description: >-
      Use these endpoints to view the available query pipeline stages and their
      configuration parameters.
  - name: Query Stage Plugins API
    description: >-
      Use these endpoints to view, install, and manage custom query stages
      developed with the Query Stage SDK.
  - name: Signal Indexing API
    description: Endpoints to index signals.
  - name: Experience Manager API
    description: API only for internal use by the Experience Manager Springboard system
  - name: Query Pipeline Template API
    description: Used internally to generate query pipelines from a template.
externalDocs:
  description: Lucidworks Documentation.
  url: https://doc.lucidworks.com/
paths:
  /experience-manager/query-rewrites:
    post:
      tags:
        - Experience Manager API
      summary: Update a query rewrite rule
      description: Creates or updates a query rewrite rule in the Experience Manager.
      operationId: updateQueryRewriteUsingPOST
      parameters:
        - name: commitWithin
          in: query
          description: Time in milliseconds within which the update should be committed.
          schema:
            type: string
        - name: context
          in: query
          description: Application context for the query rewrite request.
          required: true
          schema:
            type: string
        - name: staging
          in: query
          description: >-
            Indicates whether the query rewrite should be applied in a staging
            environment.
          required: true
          schema:
            type: boolean
        - name: version
          in: query
          description: Optional version number of the query rewrite update.
          schema:
            type: integer
            format: int64
      requestBody:
        description: Details of the query rewrite rule to be created or updated.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QueryRewriteReq'
      responses:
        '200':
          description: Query rewrite rule successfully updated.
          content:
            application/json:
              schema:
                type: object
        '201':
          description: Query rewrite rule successfully created.
          content: {}
        '401':
          description: >-
            Unauthorized request. The caller does not have permission to update
            query rewrites.
          content: {}
        '403':
          description: Forbidden request. The user does not have the required privileges.
          content: {}
        '404':
          description: Query rewrite rule not found.
          content: {}
components:
  schemas:
    QueryRewriteReq:
      title: Query Rewrite Request
      type: object
      description: Represents a request to create or update a query rewrite rule.
      properties:
        base_object_id_s:
          type: string
          description: >-
            The unique identifier of the base object associated with this query
            rewrite.
        createdOn:
          type: string
          format: date-time
          description: Timestamp indicating when the query rewrite was created.
        deployed:
          type: boolean
          description: Indicates whether the query rewrite rule is currently deployed.
        id:
          type: string
          description: Unique identifier for the query rewrite.
        is_deleted:
          type: boolean
          description: Indicates whether the query rewrite has been deleted.
        review:
          type: string
          enum:
            - approved
            - auto
            - denied
            - pending
            - supplied
          description: The current review status of the query rewrite.
        reviewedOn:
          type: string
          format: date-time
          description: Timestamp indicating when the query rewrite was last reviewed.
        reviewer:
          type: string
          description: Identifier of the user who reviewed the query rewrite.
        source:
          type: string
          description: The source from which the query rewrite originated.
        sourceType:
          type: string
          description: Type of source associated with the query rewrite.
        tags:
          type: array
          description: A list of tags associated with the query rewrite.
          items:
            type: string
        updatedOn:
          type: string
          format: date-time
          description: Timestamp indicating when the query rewrite was last updated.
  securitySchemes:
    Basic auth:
      type: http
      scheme: basic
    API key:
      name: x-api-key
      type: apiKey
      in: header

````