110 lines
1.8 KiB
Plaintext
110 lines
1.8 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.indices.create({
|
|
index: "network-traffic",
|
|
mappings: {
|
|
properties: {
|
|
ipv4: {
|
|
type: "ip",
|
|
},
|
|
ipv6: {
|
|
type: "ip",
|
|
},
|
|
},
|
|
},
|
|
});
|
|
console.log(response);
|
|
|
|
const response1 = await client.bulk({
|
|
index: "network-traffic",
|
|
refresh: "true",
|
|
operations: [
|
|
{
|
|
index: {
|
|
_id: 0,
|
|
},
|
|
},
|
|
{
|
|
ipv4: "192.168.1.10",
|
|
ipv6: "2001:db8:a4f8:112a:6001:0:12:7f10",
|
|
},
|
|
{
|
|
index: {
|
|
_id: 1,
|
|
},
|
|
},
|
|
{
|
|
ipv4: "192.168.1.12",
|
|
ipv6: "2001:db8:a4f8:112a:6001:0:12:7f12",
|
|
},
|
|
{
|
|
index: {
|
|
_id: 2,
|
|
},
|
|
},
|
|
{
|
|
ipv4: "192.168.1.33",
|
|
ipv6: "2001:db8:a4f8:112a:6001:0:12:7f33",
|
|
},
|
|
{
|
|
index: {
|
|
_id: 3,
|
|
},
|
|
},
|
|
{
|
|
ipv4: "192.168.1.10",
|
|
ipv6: "2001:db8:a4f8:112a:6001:0:12:7f10",
|
|
},
|
|
{
|
|
index: {
|
|
_id: 4,
|
|
},
|
|
},
|
|
{
|
|
ipv4: "192.168.2.41",
|
|
ipv6: "2001:db8:a4f8:112c:6001:0:12:7f41",
|
|
},
|
|
{
|
|
index: {
|
|
_id: 5,
|
|
},
|
|
},
|
|
{
|
|
ipv4: "192.168.2.10",
|
|
ipv6: "2001:db8:a4f8:112c:6001:0:12:7f10",
|
|
},
|
|
{
|
|
index: {
|
|
_id: 6,
|
|
},
|
|
},
|
|
{
|
|
ipv4: "192.168.2.23",
|
|
ipv6: "2001:db8:a4f8:112c:6001:0:12:7f23",
|
|
},
|
|
{
|
|
index: {
|
|
_id: 7,
|
|
},
|
|
},
|
|
{
|
|
ipv4: "192.168.3.201",
|
|
ipv6: "2001:db8:a4f8:114f:6001:0:12:7201",
|
|
},
|
|
{
|
|
index: {
|
|
_id: 8,
|
|
},
|
|
},
|
|
{
|
|
ipv4: "192.168.3.107",
|
|
ipv6: "2001:db8:a4f8:114f:6001:0:12:7307",
|
|
},
|
|
],
|
|
});
|
|
console.log(response1);
|
|
----
|