Summary

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

API Stability Long-Term

Syntax

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

For the input, you would provide a string and a limit name on which to filter search results. You can limit search to views, repositories, or both by providing a type of filter, and you can choose to include hidden search domains. See the Input Parameters section for more.

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

Example

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
    }
  }
}

Input Parameters

For the input, you would provide a string and a limit name on which to filter search results. You can limit the search to views, repositories, or both by providing a type of filter (see second table below), and you can choose to include hidden search domains. You can also specify the key factor on which you want to sort the results (see third table).

Table: Input Parameters & Datatypes

Parameter Type Required Default Description
This table contains all input parameters for this query. Since some of the parameters use special datatypes, additional tables for them are included below.
deleted boolean     Whether to return only deleted search domains. This requires permission to access them.
includeHidden boolean     Whether to include hidden repositories and views.
limit integer   50 The number of results to return.
limitName string     Filter results by name of connected limit. Search domains without a limit will be excluded.
orderBy OrderBy   ASC How to order results. See table below.
searchFilter string     Filter results based on this string.
skip integer   0 The number of results to skip, or the offset to use.
sortBy Searchdomain__SortBy yes   The basis for sorting results. See table below.
typeFilter SearchDomainTypes yes   Whether to sort results by repositories, views, or both. See table below.

The first special datatype used by this query is a simple enumerated list of types of search domains. Below is a list of them:

Table: SearchDomainTypes Enum Datatype

ParameterTypeRequiredDefaultStabilityDescription
Some input parameters may be required, as indicated in the Required column. For return values, this indicates that you are assured a value if the field is requested for 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 second special 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 Enum Datatype

ParameterTypeRequiredDefaultStabilityDescription
Some input parameters may be required, as indicated in the Required column. For return values, this indicates that you are assured a value if the field is requested for 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 Values

For the results, you can get the total number of search domains found, as well as plenty of data on each. The table below shows these two choices and a link to all of the details you can get with the sub-choices.

Table: SearchDomainSearchResultSet Datatype

ParameterTypeRequiredDefaultStabilityDescription
Some input parameters may be required, as indicated in the Required column. For return values, this indicates that you are assured a value if the field is requested for 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.