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

22 lines
726 B
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.scriptsPainlessExecute({
script: {
source:
'\n String response=dissect(\'%{clientip} %{ident} %{auth} [%{@timestamp}] "%{verb} %{request} HTTP/%{httpversion}" %{response} %{size}\').extract(doc["message"].value)?.response;\n if (response != null) emit(Integer.parseInt(response)); \n ',
},
context: "long_field",
context_setup: {
index: "my-index",
document: {
message:
'247.37.0.0 - - [30/Apr/2020:14:31:22 -0500] "GET /images/hm_nbg.jpg HTTP/1.0" 304 0',
},
},
});
console.log(response);
----