Files
elasticsearch-js/docs/doc_examples/1d252d9217c61c2c1cbe7a92f77b078f.asciidoc
2024-07-29 17:10:05 -05:00

72 lines
1.3 KiB
Plaintext

// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.security.queryApiKeys({
size: 0,
query: {
bool: {
must: {
term: {
invalidated: false,
},
},
should: [
{
range: {
expiration: {
gte: "now",
},
},
},
{
bool: {
must_not: {
exists: {
field: "expiration",
},
},
},
},
],
minimum_should_match: 1,
},
},
aggs: {
keys_by_username: {
composite: {
sources: [
{
usernames: {
terms: {
field: "username",
},
},
},
],
},
aggs: {
expires_soon: {
filter: {
range: {
expiration: {
lte: "now+30d/d",
},
},
},
aggs: {
key_names: {
terms: {
field: "name",
},
},
},
},
},
},
},
});
console.log(response);
----