Added/updated snippets for docs (#2318)
This commit is contained in:
49
docs/doc_examples/5f7b59d4fad0bdce6b09abb520ddb51d.asciidoc
Normal file
49
docs/doc_examples/5f7b59d4fad0bdce6b09abb520ddb51d.asciidoc
Normal file
@ -0,0 +1,49 @@
|
||||
// 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.search({
|
||||
index: "my-data-stream",
|
||||
runtime_mappings: {
|
||||
"source.ip": {
|
||||
type: "ip",
|
||||
script:
|
||||
"\n String sourceip=grok('%{IPORHOST:sourceip} .*').extract(doc[ \"message\" ].value)?.sourceip;\n if (sourceip != null) emit(sourceip);\n ",
|
||||
},
|
||||
},
|
||||
query: {
|
||||
bool: {
|
||||
filter: [
|
||||
{
|
||||
range: {
|
||||
"@timestamp": {
|
||||
gte: "now-1d/d",
|
||||
lt: "now/d",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
range: {
|
||||
"source.ip": {
|
||||
gte: "192.0.2.0",
|
||||
lte: "192.0.2.255",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
fields: ["*"],
|
||||
_source: false,
|
||||
sort: [
|
||||
{
|
||||
"@timestamp": "desc",
|
||||
},
|
||||
{
|
||||
"source.ip": "desc",
|
||||
},
|
||||
],
|
||||
});
|
||||
console.log(response);
|
||||
----
|
||||
Reference in New Issue
Block a user