Summary

The updateDefaultQueryPrefix() mutation sets or clears the default query prefix for a group. A default query prefix is automatically prepended to every query run by group members. It scopes their searches to a specific data subset — such as a repository filter, tag value, or field constraint — without requiring them to enter the prefix manually. Use this mutation to restrict or broaden query scope for a group. To clear an existing prefix, omit queryPrefix or pass a null value. This restores unrestricted query scope for the group.

Syntax

graphql
updateDefaultQueryPrefix(
      input: UpdateDefaultQueryPrefixInput!
   ): UpdateDefaultQueryPrefixMutation!

The mutation accepts a single required input argument of type UpdateDefaultQueryPrefixInput!. Provide the target group identifier and, optionally, the query prefix to apply. The mutation returns a non-null UpdateDefaultQueryPrefixMutation! object containing the updated group.

To clear the default query prefix, omit queryPrefix or pass a null value. After clearing, group members run queries with no automatic prefix applied.

Input parameters

The UpdateDefaultQueryPrefixInput! type accepts the following arguments. Provide groupId to identify the target group — this is the unique identifier returned by group() or groupsPage(), not the display name. Provide queryPrefix to set the search filter that LogScale prepends to all queries run by group members. Omit queryPrefix to clear the existing prefix.

Table: UpdateDefaultQueryPrefixInput Input Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
groupIdStringyes    
queryPrefixString     

Example

Raw
graphql
mutation {
  updateDefaultQueryPrefix( input: 
    {
      queryPrefix: "sales",
      groupId: "abc123"
    }
  )
  { group { displayName } }
}
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 {
  updateDefaultQueryPrefix( input: 
    {
      queryPrefix: \"sales\",
      groupId: \"abc123\"
    }
  )
  { group { displayName } }
}"
}
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 {
  updateDefaultQueryPrefix( input: 
    {
      queryPrefix: \"sales\",
      groupId: \"abc123\"
    }
  )
  { group { displayName } }
}"
}
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 { ^
  updateDefaultQueryPrefix( input:  ^
    { ^
      queryPrefix: \"sales\", ^
      groupId: \"abc123\" ^
    } ^
  ) ^
  { group { displayName } } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  updateDefaultQueryPrefix( input: 
    {
      queryPrefix: \"sales\",
      groupId: \"abc123\"
    }
  )
  { group { displayName } }
}"
}'
    "$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 {
  updateDefaultQueryPrefix( input: 
    {
      queryPrefix: \"sales\",
      groupId: \"abc123\"
    }
  )
  { group { displayName } }
}";
$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 {
  updateDefaultQueryPrefix( input: 
    {
      queryPrefix: \"sales\",
      groupId: \"abc123\"
    }
  )
  { group { displayName } }
}"
}'''

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 {
  updateDefaultQueryPrefix( input: 
    {
      queryPrefix: \"sales\",
      groupId: \"abc123\"
    }
  )
  { group { displayName } }
}"
}
);


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": {
    "updateDefaultQueryPrefix": {
      "group": {
        "displayName": "sales"
      }
    }
  }
}

Returned values

The mutation returns an UpdateDefaultQueryPrefixMutation! object. Request group.defaultQueryPrefix to confirm the applied prefix, or verify it is null when the prefix was cleared. The group field exposes the full Group type, including membership, roles, and accessible assets. The clientMutationId field is available for Relay-compatible clients that require a correlation identifier.

Table: UpdateDefaultQueryPrefixMutation Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
groupGroupyes Long-Term Â