Update a query rewrite
import requests
url = "https://{commerce_studio_id}.experiencemanager.lucidworks.com/query-rewrites/{id}"
payload = { "type": "HEAD_TAIL" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.put("https://{commerce_studio_id}.experiencemanager.lucidworks.com/query-rewrites/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"HEAD_TAIL\"\n}")
.asString();const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({type: 'HEAD_TAIL'})
};
fetch('https://{commerce_studio_id}.experiencemanager.lucidworks.com/query-rewrites/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://{commerce_studio_id}.experiencemanager.lucidworks.com/query-rewrites/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"HEAD_TAIL\"\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{commerce_studio_id}.experiencemanager.lucidworks.com/query-rewrites/{id}"
payload := strings.NewReader("{\n \"type\": \"HEAD_TAIL\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{commerce_studio_id}.experiencemanager.lucidworks.com/query-rewrites/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'HEAD_TAIL'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}curl --request PUT \
--url https://{commerce_studio_id}.experiencemanager.lucidworks.com/query-rewrites/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "HEAD_TAIL"
}
'{
"type": "HEAD_TAIL",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdBy": "<string>",
"creationDate": "2023-11-07T05:31:56Z",
"lastModifiedBy": "<string>",
"lastModified": "2023-11-07T05:31:56Z",
"published": true,
"version": "2023-11-07T05:31:56Z",
"stagingFusionSyncStatus": {
"lastSyncedVersion": "2023-11-07T05:31:56Z",
"fusionVersion": "<string>"
},
"liveFusionSyncStatus": {
"lastSyncedVersion": "2023-11-07T05:31:56Z",
"fusionVersion": "<string>"
},
"markedForDeletion": true,
"description": "<string>",
"externalId": "<string>",
"migratedId": "<string>",
"surfaceForm": "<string>",
"outputs": [
"<string>"
]
}Update a query rewrite
Update a query rewrite.
PUT
/
query-rewrites
/
{id}
Update a query rewrite
import requests
url = "https://{commerce_studio_id}.experiencemanager.lucidworks.com/query-rewrites/{id}"
payload = { "type": "HEAD_TAIL" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.put("https://{commerce_studio_id}.experiencemanager.lucidworks.com/query-rewrites/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"HEAD_TAIL\"\n}")
.asString();const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({type: 'HEAD_TAIL'})
};
fetch('https://{commerce_studio_id}.experiencemanager.lucidworks.com/query-rewrites/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://{commerce_studio_id}.experiencemanager.lucidworks.com/query-rewrites/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"HEAD_TAIL\"\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{commerce_studio_id}.experiencemanager.lucidworks.com/query-rewrites/{id}"
payload := strings.NewReader("{\n \"type\": \"HEAD_TAIL\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{commerce_studio_id}.experiencemanager.lucidworks.com/query-rewrites/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'HEAD_TAIL'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}curl --request PUT \
--url https://{commerce_studio_id}.experiencemanager.lucidworks.com/query-rewrites/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "HEAD_TAIL"
}
'{
"type": "HEAD_TAIL",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdBy": "<string>",
"creationDate": "2023-11-07T05:31:56Z",
"lastModifiedBy": "<string>",
"lastModified": "2023-11-07T05:31:56Z",
"published": true,
"version": "2023-11-07T05:31:56Z",
"stagingFusionSyncStatus": {
"lastSyncedVersion": "2023-11-07T05:31:56Z",
"fusionVersion": "<string>"
},
"liveFusionSyncStatus": {
"lastSyncedVersion": "2023-11-07T05:31:56Z",
"fusionVersion": "<string>"
},
"markedForDeletion": true,
"description": "<string>",
"externalId": "<string>",
"migratedId": "<string>",
"surfaceForm": "<string>",
"outputs": [
"<string>"
]
}Authorizations
Headers
Path Parameters
Query Parameters
Body
application/json
- HeadTailQueryRewriteRequest
- MisspellingQueryRewriteRequest
- PhraseQueryRewriteRequest
- RemoveWordsQueryRewriteRequest
- SynonymQueryRewriteRequest
Replace underperforming queries with queries that produce higher click-through rates.
Response
200 - application/json
OK
- HeadTailQueryRewriteSummary
- MisspellingQueryRewriteSummary
- PhraseQueryRewriteSummary
- RemoveWordsQueryRewriteSummary
- SynonymQueryRewriteSummary
Replace underperforming queries with queries that produce higher click-through rates.
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.
Was this page helpful?