Find users with a query
- POST also GET /_security/_query/user
Get information for users in a paginated manner. You can optionally filter the results with a query.
NOTE: As opposed to the get user API, built-in users are excluded from the result. This API is only for native users.
- Cluster privileges:
read_security
Query Parameters
-
with_profile_uidboolean · default: false Determines whether to retrieve the user profile UID, if it exists, for the users.
Request
-
queryUserQueryContainer -
A query to filter which users to return. If the query parameter is missing, it is equivalent to a
match_allquery. The query supports a subset of query types, includingmatch_all,bool,term,terms,match,ids,prefix,wildcard,exists,range, andsimple_query_string. You can query the following information associated with user:username,roles,enabled,full_name, andemail. -
idsIdsQuery -
Returns users based on their IDs. This query uses the user document IDs stored in the
_idfield. -
boostnumber · default: 1 -
Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.
-
_namestring -
valuesstring Ids -
An array of document IDs.
-
boolBoolQuery -
matches users matching boolean combinations of other queries.
-
boostnumber · default: 1 -
Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.
-
_namestring -
filteroneOf -
The clause (query) must appear in matching documents. However, unlike
must, the score of the query will be ignored. -
minimum_should_matchnumber | string MinimumShouldMatch -
Specifies the number or percentage of
shouldclauses returned documents must match. -
mustoneOf -
The clause (query) must appear in matching documents and will contribute to the score.
-
must_notoneOf -
The clause (query) must not appear in the matching documents. Because scoring is ignored, a score of
0is returned for all documents. -
shouldoneOf -
The clause (query) should appear in the matching document.
-
existsExistsQuery -
Returns users that contain an indexed value for a field.
-
boostnumber · default: 1 -
Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.
-
_namestring -
fieldstring Fieldrequired -
Name of the field you wish to search.
-
matchmap string to MatchQuery -
Returns users that match a provided text, number, date or boolean value. The provided text is analyzed before matching.
-
<string>MatchQuery -
boostnumber · default: 1 -
Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.
-
_namestring -
analyzerstring -
Analyzer used to convert the text in the query value into tokens.
-
auto_generate_synonyms_phrase_queryboolean · default: true -
If
true, match phrase queries are automatically created for multi-term synonyms. -
cutoff_frequencynumberdeprecated -
fuzzinessnumber | string Fuzziness -
Maximum edit distance allowed for matching.
-
fuzzy_rewritestring -
Method used to rewrite the query.
-
fuzzy_transpositionsboolean · default: true -
If
true, edits for fuzzy matching include transpositions of two adjacent characters (for example,abtoba). -
lenientboolean · default: false -
If
true, format-based errors, such as providing a text query value for a numeric field, are ignored. -
max_expansionsnumber · default: 50 -
Maximum number of terms to which the query will expand.
-
minimum_should_matchnumber | string MinimumShouldMatch -
Minimum number of clauses that must match for a document to be returned.
-
operatorOperator · default: 'or' -
Boolean logic used to interpret text in the query value.
-
Values:
andANDorOR -
prefix_lengthnumber · default: 0 -
Number of beginning characters left unchanged for fuzzy matching.
-
queryboolean | number | stringrequired -
Text, number, boolean value or date you wish to find in the provided field.
-
zero_terms_queryZeroTermsQuery · default: 'none' -
Indicates whether no documents are returned if the
analyzerremoves all tokens, such as when using astopfilter.Supported values include:
all: Returns all documents, similar to amatch_allquery.none: No documents are returned if theanalyzerremoves all tokens.
-
Values:
allnone -
match_allMatchAllQuery -
Matches all users, giving them all a
_scoreof 1.0. -
prefixmap string to PrefixQuery -
Returns users that contain a specific prefix in a provided field.
-
<string>PrefixQuery -
boostnumber · default: 1 -
Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.
-
_namestring -
rewritestring -
Method used to rewrite the query.
-
valuestringrequired -
Beginning characters of terms you wish to find in the provided field.
-
case_insensitiveboolean · default: false -
Allows ASCII case insensitive matching of the value with the indexed field values when set to
true. Default isfalsewhich means the case sensitivity of matching depends on the underlying field’s mapping. -
rangemap string to RangeQuery -
Returns users that contain terms within a provided range.
-
simple_query_stringSimpleQueryStringQuery -
Returns users based on a provided query string, using a parser with a limited but fault-tolerant syntax.
-
boostnumber · default: 1 -
Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.
-
_namestring -
analyzerstring -
Analyzer used to convert text in the query string into tokens.
-
analyze_wildcardboolean · default: false -
If
true, the query attempts to analyze wildcard terms in the query string. -
auto_generate_synonyms_phrase_queryboolean · default: true -
If
true, the parser creates a match_phrase query for each multi-position token. -
default_operatorOperator · default: 'or' -
Default boolean logic used to interpret text in the query string if no operators are specified.
-
Values:
andANDorOR -
fieldsstring Field -
Array of fields you wish to search. Accepts wildcard expressions. You also can boost relevance scores for matches to particular fields using a caret (
^) notation. Defaults to theindex.query.default_field indexsetting, which has a default value of*. -
flagsSimpleQueryStringFlags · default: ALL -
List of enabled operators for the simple query string syntax.
-
Values:
NONEANDNOTORPREFIXPHRASEPRECEDENCEESCAPEWHITESPACEFUZZYNEARSLOPALL -
fuzzy_max_expansionsnumber · default: 50 -
Maximum number of terms to which the query expands for fuzzy matching.
-
fuzzy_prefix_lengthnumber · default: 0 -
Number of beginning characters left unchanged for fuzzy matching.
-
fuzzy_transpositionsboolean -
If
true, edits for fuzzy matching include transpositions of two adjacent characters (for example,abtoba). -
lenientboolean · default: false -
If
true, format-based errors, such as providing a text value for a numeric field, are ignored. -
minimum_should_matchnumber | string MinimumShouldMatch -
Minimum number of clauses that must match for a document to be returned.
-
querystringrequired -
Query string in the simple query string syntax you wish to parse and use for search.
-
quote_field_suffixstring -
Suffix appended to quoted text in the query string.
-
termmap string to TermQuery -
Returns users that contain an exact term in a provided field. To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization.
-
<string>TermQuery -
boostnumber · default: 1 -
Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.
-
_namestring -
valueFieldValuerequired -
Term you wish to find in the provided field.
-
case_insensitiveboolean · default: false -
Allows ASCII case insensitive matching of the value with the indexed field values when set to
true. Whenfalse, the case sensitivity of matching depends on the underlying field’s mapping. -
termsTermsQuery -
Returns users that contain one or more exact terms in a provided field. To return a document, one or more terms must exactly match a field value, including whitespace and capitalization.
-
wildcardmap string to WildcardQuery -
Returns users that contain terms matching a wildcard pattern.
-
<string>WildcardQuery -
boostnumber · default: 1 -
Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.
-
_namestring -
case_insensitiveboolean -
Allows case insensitive matching of the pattern with the indexed field values when set to true. Default is false which means the case sensitivity of matching depends on the underlying field’s mapping.
-
rewritestring -
Method used to rewrite the query.
-
valuestring -
Wildcard pattern for terms you wish to find in the provided field. Required, when wildcard is not set.
-
wildcardstring -
Wildcard pattern for terms you wish to find in the provided field. Required, when value is not set.
-
fromnumber · default: 0 -
The starting document offset. It must not be negative. By default, you cannot page through more than 10,000 hits using the
fromandsizeparameters. To page through more hits, use thesearch_afterparameter. -
sortSort -
The sort definition. Fields eligible for sorting are:
username,roles,enabled. In addition, sort can also be applied to the_docfield to sort by index order. - Reference
-
sizenumber · default: 10 -
The number of hits to return. It must not be negative. By default, you cannot page through more than 10,000 hits using the
fromandsizeparameters. To page through more hits, use thesearch_afterparameter.