Skip to main content
PUT
/
query-rewrite
/
instances
/
{id}
Update a query rewrite
import requests

url = "https://{FUSION HOST}/api/query-rewrite/instances/{id}"

payload = {
    "type": "banner",
    "id": "<string>"
}
headers = {
    "Authorization": "Basic <encoded-value>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
{
  "type": "banner",
  "id": "<string>",
  "source": "<string>",
  "sourceType": "<string>",
  "createdOn": "2023-11-07T05:31:56Z",
  "updatedOn": "2023-11-07T05:31:56Z",
  "reviewer": "<string>",
  "reviewedOn": "2023-11-07T05:31:56Z",
  "review": "auto",
  "deployed": true,
  "tags": [
    "<string>"
  ],
  "is_deleted": true,
  "base_object_id_s": "<string>",
  "doc_type": "<string>",
  "description": "<string>",
  "priority": 1,
  "matching": "keywords",
  "groups": "<string>",
  "rollup": "<string>"
}

Authorizations

Authorization
string
header
required

Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.

Path Parameters

id
string
required

The query rewrite ID.

Query Parameters

context
string
required

The app to which this object belongs, as app:SomeApp. If the app doesn't exist, the request fails. Other comma-separated contexts in the context parameter are allowed but ignored.

editSessionId
string

The edit session ID associated with this request. Equivalent to a Fusion username.

Body

application/json
type
required

The type of rule, written in snake case. In the Fusion UI, some of these types correspond to the types in the Rewrites Manager and others correspond to actions in the Rules Manager.

  • banner - A rule that adds an HTML-formatted banner to query responses.
  • block_list - A rule that blocks values from appearing in query results.
  • boost_attributes - A rule that boosts documents in query results.
  • boost_list - A rule that boosts documents with a large multiplicative boost.
  • bury_list - A rule that buries documents so they are minimized but not blocked.
  • filter_list - A rule that applies filter queries (fq) to matching queries.
  • ground_truth - A query rewrite that estimates ground truth queries using click signals and query signals.
  • ingroup_boost_list - A rule that boosts an item within a product group.
  • ingroup_bury_list - A rule that buries an item within a product group.
  • ingroup_pinned - A rule that pins a document to a specific location within a product group.
  • json_blob - A rule that returns an arbitrary JSON blob for display outside of the search results.
  • phrase - A query rewrite that boosts phrases when they appear in queries.
  • pinned - A rule that pins a document to a specific location within the search results.
  • redirect - A rule that adds a redirect message to the query response.
  • removeWords - A query rewrite that removes phrases from queries.
  • response_value - A rule that sends an arbitrary value to the front end or pipeline.
  • set_facets - A rule that customizes the facets returned in the query response.
  • set_params - A rule that sets a parameter name and value to a search query.
  • simq - A query rewrite that detects overlap between the results of similar queries.
  • spell - A query rewrite that maps misspellings to their corrected spellings.
  • synonym - A query rewrite that maps query terms to their synonyms.
  • tail - A query rewrite that replaces under-performing queries with queries that produce higher click-through rates.
Available options:
banner,
block_list,
boost_attributes,
boost_list,
bury_list,
filter_list,
ground_truth,
ingroup_boost_list,
ingroup_bury_list,
ingroup_pinned,
json_blob,
phrase,
pinned,
redirect,
removeWords,
response_value,
set_facets,
set_params,
simq,
spell,
synonym,
tail
id
string
required

A unique ID for the query rewrite. Allowed characters: a-z, A-Z, 0-9, dash (-) and underscore (_)

source
string

The name of the source that made the update, such as a Spark job.

sourceType
string

The type of source that made the update.

createdOn
string<date-time>

A timestamp value that describes when the rule was created.

updatedOn
string<date-time>

A timestamp value that describes when the rule was last modified.

reviewer
string

Who reviewed this rewrite rule.

reviewedOn
string<date-time>

Date/Time this rule was last reviewed.

review
enum<string>

The query rewrite's review status.

Available options:
auto,
pending,
approved,
denied,
supplied
deployed
boolean

Describes whether the query rewrite is published.

When true, the query rewrite is published and the latest changes are live. When false, the latest changes are not live, though previous versions may be live.

tags
string[]

An array of conditional tags that are used to restrict the triggering of the query rewrite.

is_deleted
boolean

Describes whether the query rewrite is marked for deletion.

When true, the query rewrite will be deleted when the latest changes are published. When false, the query rewrite will not be deleted when the latest changes are published.

base_object_id_s
string

A unique ID for the query rewrite. Matches the value of id.

doc_type
string

Either query_rewrite or rule.

description
string

The rule description.

priority
integer
default:1

Specifies the rule’s precedence when multiple rules could apply to the same query.

Higher values indicate higher precedence: the rule with the highest precedence is applied last and takes final effect. For example, a rule with precedence 3 will override a rule with precedence 2.

If two rules have the same precedence, the more recently created rule takes precedence.

matching
enum<string>

Defines how the specified search terms will be compared to the user's query to determine whether this rule applies. 'keywords' means the query must match the keywords of the search terms value exactly. 'phrase' means the search query must contain one of the search terms values as a subphrase. 'text' means that at least one of the search terms values must match the query, but unlike 'phrase', the query only needs to match part of the value.

Available options:
keywords,
text,
phrase
groups
string

Group for this rule.

rollup
string

Response

200 - */*

OK

type
required

The type of rule, written in snake case. In the Fusion UI, some of these types correspond to the types in the Rewrites Manager and others correspond to actions in the Rules Manager.

  • banner - A rule that adds an HTML-formatted banner to query responses.
  • block_list - A rule that blocks values from appearing in query results.
  • boost_attributes - A rule that boosts documents in query results.
  • boost_list - A rule that boosts documents with a large multiplicative boost.
  • bury_list - A rule that buries documents so they are minimized but not blocked.
  • filter_list - A rule that applies filter queries (fq) to matching queries.
  • ground_truth - A query rewrite that estimates ground truth queries using click signals and query signals.
  • ingroup_boost_list - A rule that boosts an item within a product group.
  • ingroup_bury_list - A rule that buries an item within a product group.
  • ingroup_pinned - A rule that pins a document to a specific location within a product group.
  • json_blob - A rule that returns an arbitrary JSON blob for display outside of the search results.
  • phrase - A query rewrite that boosts phrases when they appear in queries.
  • pinned - A rule that pins a document to a specific location within the search results.
  • redirect - A rule that adds a redirect message to the query response.
  • removeWords - A query rewrite that removes phrases from queries.
  • response_value - A rule that sends an arbitrary value to the front end or pipeline.
  • set_facets - A rule that customizes the facets returned in the query response.
  • set_params - A rule that sets a parameter name and value to a search query.
  • simq - A query rewrite that detects overlap between the results of similar queries.
  • spell - A query rewrite that maps misspellings to their corrected spellings.
  • synonym - A query rewrite that maps query terms to their synonyms.
  • tail - A query rewrite that replaces under-performing queries with queries that produce higher click-through rates.
Available options:
banner,
block_list,
boost_attributes,
boost_list,
bury_list,
filter_list,
ground_truth,
ingroup_boost_list,
ingroup_bury_list,
ingroup_pinned,
json_blob,
phrase,
pinned,
redirect,
removeWords,
response_value,
set_facets,
set_params,
simq,
spell,
synonym,
tail
id
string
required

A unique ID for the query rewrite. Allowed characters: a-z, A-Z, 0-9, dash (-) and underscore (_)

source
string

The name of the source that made the update, such as a Spark job.

sourceType
string

The type of source that made the update.

createdOn
string<date-time>

A timestamp value that describes when the rule was created.

updatedOn
string<date-time>

A timestamp value that describes when the rule was last modified.

reviewer
string

Who reviewed this rewrite rule.

reviewedOn
string<date-time>

Date/Time this rule was last reviewed.

review
enum<string>

The query rewrite's review status.

Available options:
auto,
pending,
approved,
denied,
supplied
deployed
boolean

Describes whether the query rewrite is published.

When true, the query rewrite is published and the latest changes are live. When false, the latest changes are not live, though previous versions may be live.

tags
string[]

An array of conditional tags that are used to restrict the triggering of the query rewrite.

is_deleted
boolean

Describes whether the query rewrite is marked for deletion.

When true, the query rewrite will be deleted when the latest changes are published. When false, the query rewrite will not be deleted when the latest changes are published.

base_object_id_s
string

A unique ID for the query rewrite. Matches the value of id.

doc_type
string

Either query_rewrite or rule.

description
string

The rule description.

priority
integer
default:1

Specifies the rule’s precedence when multiple rules could apply to the same query.

Higher values indicate higher precedence: the rule with the highest precedence is applied last and takes final effect. For example, a rule with precedence 3 will override a rule with precedence 2.

If two rules have the same precedence, the more recently created rule takes precedence.

matching
enum<string>

Defines how the specified search terms will be compared to the user's query to determine whether this rule applies. 'keywords' means the query must match the keywords of the search terms value exactly. 'phrase' means the search query must contain one of the search terms values as a subphrase. 'text' means that at least one of the search terms values must match the query, but unlike 'phrase', the query only needs to match part of the value.

Available options:
keywords,
text,
phrase
groups
string

Group for this rule.

rollup
string