70 lines
1.4 KiB
Plaintext
70 lines
1.4 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: "my-index-000001",
|
|
mappings: {
|
|
dynamic_templates: [
|
|
{
|
|
numeric_counts: {
|
|
match_mapping_type: ["long", "double"],
|
|
match: "count",
|
|
mapping: {
|
|
type: "{dynamic_type}",
|
|
index: false,
|
|
},
|
|
},
|
|
},
|
|
{
|
|
integers: {
|
|
match_mapping_type: "long",
|
|
mapping: {
|
|
type: "integer",
|
|
},
|
|
},
|
|
},
|
|
{
|
|
strings: {
|
|
match_mapping_type: "string",
|
|
mapping: {
|
|
type: "text",
|
|
fields: {
|
|
raw: {
|
|
type: "keyword",
|
|
ignore_above: 256,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
non_objects_keyword: {
|
|
match_mapping_type: "*",
|
|
unmatch_mapping_type: "object",
|
|
mapping: {
|
|
type: "keyword",
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
});
|
|
console.log(response);
|
|
|
|
const response1 = await client.index({
|
|
index: "my-index-000001",
|
|
id: 1,
|
|
document: {
|
|
my_integer: 5,
|
|
my_string: "Some string",
|
|
my_boolean: "false",
|
|
field: {
|
|
count: 4,
|
|
},
|
|
},
|
|
});
|
|
console.log(response1);
|
|
----
|