The updateSavedQuery() GraphQL mutation is used to update a saved query in LogScale.

Related to this mutation, there are the mutations, createSavedQuery(), copySavedQuery(), and deleteSavedQueryV2() for creating, copying, and deleting saved queries. There are also the createSavedQueryFromTemplate() mutation for creating a saved query using a YAML template, and createSavedQueryFromPackageTemplate() to create one from a template in a package. There is also setDefaultSavedQuery() for marking a saved query as the default.

For more information on saved queries, see the Saved Searches (User Functions) reference page where saved queries are discussed. Also, look at the Search Data documentation page as it relates to recent queries and saving queries.

Hide Query Example

Show Saved Queries Query

API Stability Long-Term

Syntax

graphql
updateSavedQuery(
     input: UpdateSavedQueryInput!
   ): UpdateSavedQueryPayload!

For the input, you'll have to give the name of the view, the saved query's identifier, and whatever you want to change (e.g., the query used). Click on Show Query above to find the identifier. See the Given Datatype section for details on the input parameters.

For the results, you can get a yaml template of the saved query, and related data. See the Returned Datatype section for more.

Example

Raw
graphql
mutation {
  updateSavedQuery( input:
     { id: "abc123",
       viewName: "humio",
       isLive: false
     } 
  )
  { savedQuery { id } }
}
Mac OS or Linux (curl)
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  updateSavedQuery( input:
     { id: \"abc123\",
       viewName: \"humio\",
       isLive: false
     } 
  )
  { savedQuery { id } }
}"
}
EOF
Mac OS or Linux (curl) One-line
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  updateSavedQuery( input:
     { id: \"abc123\",
       viewName: \"humio\",
       isLive: false
     } 
  )
  { savedQuery { id } }
}"
}
EOF
Windows Cmd and curl
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql ^
    -H "Authorization: Bearer $TOKEN" ^
    -H "Content-Type: application/json" ^
    -d @'{"query" : "mutation { ^
  updateSavedQuery( input: ^
     { id: \"abc123\", ^
       viewName: \"humio\", ^
       isLive: false ^
     }  ^
  ) ^
  { savedQuery { id } } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  updateSavedQuery( input:
     { id: \"abc123\",
       viewName: \"humio\",
       isLive: false
     } 
  )
  { savedQuery { id } }
}"
}'
    "$YOUR_LOGSCALE_URL/graphql"
Perl
perl
#!/usr/bin/perl

use HTTP::Request;
use LWP;

my $TOKEN = "TOKEN";

my $uri = '$YOUR_LOGSCALE_URL/graphql';

my $query = "mutation {
  updateSavedQuery( input:
     { id: \"abc123\",
       viewName: \"humio\",
       isLive: false
     } 
  )
  { savedQuery { id } }
}";
$query =~ s/\n/ /g;
my $json = sprintf('{"query" : "%s"}',$query);
my $req = HTTP::Request->new("POST", $uri );

$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");

$req->content( $json );

my $lwp = LWP::UserAgent->new;

my $result = $lwp->request( $req );

print $result->{"_content"},"\n";
Python
python
#! /usr/local/bin/python3

import requests

url = '$YOUR_LOGSCALE_URL/graphql'
mydata = r'''{"query" : "mutation {
  updateSavedQuery( input:
     { id: \"abc123\",
       viewName: \"humio\",
       isLive: false
     } 
  )
  { savedQuery { id } }
}"
}'''

resp = requests.post(url,
                     data = mydata,
                     headers = {
   "Authorization" : "Bearer $TOKEN",
   "Content-Type" : "application/json"
}
)

print(resp.text)
Node.js
javascript
const https = require('https');

const data = JSON.stringify(
    {"query" : "mutation {
  updateSavedQuery( input:
     { id: \"abc123\",
       viewName: \"humio\",
       isLive: false
     } 
  )
  { savedQuery { id } }
}"
}
);


const options = {
  hostname: '$YOUR_LOGSCALE_URL',
  path: 'graphql',
  port: 443,
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Content-Length': data.length,
    Authorization: 'BEARER ' + process.env.TOKEN,
    'User-Agent': 'Node',
  },
};

const req = https.request(options, (res) => {
  let data = '';
  console.log(`statusCode: ${res.statusCode}`);

  res.on('data', (d) => {
    data += d;
  });
  res.on('end', () => {
    console.log(JSON.parse(data).data);
  });
});

req.on('error', (error) => {
  console.error(error);
});

req.write(data);
req.end();
Example Responses
Success (HTTP Response Code 200 OK)
json
{
  "data": {
    "updateSavedQuery": {
      "savedQuery": {
        "id": "abc123"
      }
    }
  }
}

Given Datatype

For the input datatype, you'll have to give the name of the view and the unique identifier of the saved query you want to update. After that, you can change many parameters, such as the query used by it. Click on the Show Query link above the Syntax section for an example of how to find the identifier.

Table: UpdateSavedQueryInput

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For return datatypes, this indicates that you must specify which fields you want returned in the results.
Table last updated: Sep 23, 2024
customLinkInteractions[CustomLinkInteractionInput]yes Long-TermThe custom links for interactions. See CustomLinkInteractionInput.
dashboardLinkInteractions[DashboardLinkInteractionInput]yes Long-TermThe dashboard links for interactions. See DashboardLinkInteractionInput.
endstring  Long-TermThe ending point of the saved query.
idstringyes Long-TermThe unique identifier of the saved query to update.
isLiveboolean  Long-TermWhether the saved query is executed continuously on live, streaming data.
namestring  Long-TermThe name of the saved query to update.
optionsstring  Long-TermAny options related to the saved query.
queryStringstring  Long-TermThe new query.
searchLinkInteractions[SearchLinkInteractionInput]yes Long-TermThe search links for interactions. See SearchLinkInteractionInput.
startstring  Long-TermThe starting point of the saved query.
updateParametersInteractions[UpdateParametersInteractionInput]yes Long-TermThe parameters to update for interactions. See UpdateParametersInteractionInput.
viewNamestringyes Long-TermThe name of the view associated with the saved query.
widgetTypestring  Long-TermThe type of widget for displaying the results of the saved query.

Returned Datatype

With the returned datatype, by way of sub-parameters, you can get a yaml template of the saved query, when and who created it, and other related data. The table below contains a link to another table with the sub-parameters:

Table: UpdateSavedQueryPayload

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For return datatypes, this indicates that you must specify which fields you want returned in the results.
Table last updated: Oct 4, 2024
savedQuerySavedQueryyes Long-TermThe saved query to update. See SavedQuery.

The datatype above uses another datatype for information on the saved query. For your convenience, the table for that sub-datatype is included here:

Table: SavedQuery

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For return datatypes, this indicates that you must specify which fields you want returned in the results.
Table last updated: Apr 13, 2026
allowedActions[AssetAction]yes Short-TermThe allowed asset actions. See AssetAction . This is a preview and subject to change.
createdInfoAssetCommitMetadata  Long-TermMetadata related to the creation of the saved query. See AssetCommitMetadata.
descriptionstring  Long-TermA description of the saved query.
displayNamestringyes Long-TermThe display name of the saved query.
idstringyes Long-TermThe unique identifier for the saved query.
interactions[QueryBasedWidgetInteraction]yes Long-TermThe interactions of the saved query. See QueryBasedWidgetInteraction.
isStarredbooleanyes Long-TermWhether the saved query has been marked with a star.
labels[string]yes Long-TermThe labels associated with this saved query.
modifiedInfoAssetCommitMetadata  Long-TermMetadata related to the latest modification of the saved query. See AssetCommitMetadata.
namestringyes Long-TermThe name of the saved query.
optionsJSONyes Long-TermOptions related to the saved query, in JSON form. JSON is a scalar.
packagePackageInstallation  Long-TermThe package, if there is one, in which the saved query is included. See PackageInstallation.
packageIdVersionedPackageSpecifier  Long-TermThe unique identifier of the package. VersionedPackageSpecifier is a scalar value.
qualifiedNamestringyes PreviewThe fully qualified reference format, including the view.
queryHumioQueryyes Long-TermThe saved query itself. See HumioQuery.
resourcestringyes Short-TermThe resource identifier for this saved query.
widgetTypestringyes Long-TermThe type of widget used with the saved query.
yamlTemplateYAMLyes Long-TermA yaml formatted string that describes the saved query. YAML is a scalar. This replaced templateYaml starting in LogScale version 1.225.