API Stability Long-Term

The querySearchDomains() GraphQL query is used for query search domains with an organization filter.

There are a few queries that are somewhat related to this one: searchDomain(), searchDomains(), and searchDomainsPage(). There are also some related mutations: deleteSearchDomain() and deleteSearchDomainById(), as well as renameSearchDomain() and renameSearchDomainById(). Similarly, you may find the SetSearchLimitForSearchDomain() and ClearSearchLimitForSearchDomain() mutations useful.

For more information on searching repositories and views, see the Search Data documentation page.

Syntax

graphql
querySearchDomains(
     searchFilter: string,
     typeFilter: SearchDomainTypes!,
     limitName: string,
     deleted: boolean, 
     includeHidden: boolean,
     sortBy: Searchdomain__SortBy!,
     orderBy: OrderBy,
     skip: integer,
     limit: integer
   ): SearchDomainSearchResultSet!

This query field has several inputs, but not all required — as indicated by the exclamation marks. Use searchFilter to provide a string on which to base search results and typeFilter to limit search to views, repositories, or both. For the limitName, give a string to filter results by name of a connected limit. Search domains without a limit will be excluded. Use includeHidden indicate whether to include hidden domains.

The remaining inputs parameters are fairly standard, with two of them using special datatypes. They're described in the Given Datatypes section.

For the results, you can get the total number of domains found and data on each domain. See the Returned Datatype section further down this page for more on this.

Example

Below is an example of how this query field might be used:

Raw
graphql
query {
  querySearchDomains(
     searchFilter: "metrics"
     typeFilter: Repository, 
     sortBy: Name, 
     orderBy: DESC )
  { results {id, name},
      totalResults }
}
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" : "query {
  querySearchDomains(
     searchFilter: \"metrics\"
     typeFilter: Repository, 
     sortBy: Name, 
     orderBy: DESC )
  { results {id, name},
      totalResults }
}"
}
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" : "query {
  querySearchDomains(
     searchFilter: \"metrics\"
     typeFilter: Repository, 
     sortBy: Name, 
     orderBy: DESC )
  { results {id, name},
      totalResults }
}"
}
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" : "query { ^
  querySearchDomains( ^
     searchFilter: \"metrics\" ^
     typeFilter: Repository,  ^
     sortBy: Name,  ^
     orderBy: DESC ) ^
  { results {id, name}, ^
      totalResults } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "query {
  querySearchDomains(
     searchFilter: \"metrics\"
     typeFilter: Repository, 
     sortBy: Name, 
     orderBy: DESC )
  { results {id, name},
      totalResults }
}"
}'
    "$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 = "query {
  querySearchDomains(
     searchFilter: \"metrics\"
     typeFilter: Repository, 
     sortBy: Name, 
     orderBy: DESC )
  { results {id, name},
      totalResults }
}";
$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" : "query {
  querySearchDomains(
     searchFilter: \"metrics\"
     typeFilter: Repository, 
     sortBy: Name, 
     orderBy: DESC )
  { results {id, name},
      totalResults }
}"
}'''

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" : "query {
  querySearchDomains(
     searchFilter: \"metrics\"
     typeFilter: Repository, 
     sortBy: Name, 
     orderBy: DESC )
  { results {id, name},
      totalResults }
}"
}
);


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": {
    "querySearchDomains": {
      "results": [
        {
          "id": "vPKtNNHvI9z8BKcwTPKCUTSP",
          "name": "humio-metrics"
        }
      ],
      "totalResults": 1
    }
  }
}

Given Datatypes

The first input datatype is a simple enumerated list of types of search domains (e.g., view). Below is a list of them:

Table: SearchDomainTypes

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 3, 2025
All   Long-TermDon't limit searches to a specific type of search domain.
Repository   Long-TermLimit searches to repositories.
Views   Long-TermSearch only views and not repositories.

The input datatype is an enumerated list of factors by which search domains can be sorted (e.g., by name). Below is a list of choices along with brief descriptions of them:

Table: Searchdomain__SortBy

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: Jun 24, 2025
DeletedAt   Long-TermSort based on when deleted.
LimitName   Long-TermSort based on limit name.
Name   Long-TermSort based on name of search domain.
Volume   Long-TermSort based on volume.

Returned Datatype

The returned datatype for this query is used to get the total number of search domains found, as well as plenty of data on each by way of the SearchDomain datatype. The table below shows these two parameters and a link to all of the details you can get with the sub-parameter.

Table: SearchDomainSearchResultSet

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 3, 2024
results[SearchDomain]yes Long-TermThe paginated results set. See SearchDomain.
totalResultsintegeryes Long-TermThe total number of matching results.