Added/updated snippets for docs (#2318)
This commit is contained in:
95
docs/doc_examples/840b6c5c3d9c56aed854cfab8da04486.asciidoc
Normal file
95
docs/doc_examples/840b6c5c3d9c56aed854cfab8da04486.asciidoc
Normal file
@ -0,0 +1,95 @@
|
||||
// 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: "file-path-test",
|
||||
settings: {
|
||||
analysis: {
|
||||
analyzer: {
|
||||
custom_path_tree: {
|
||||
tokenizer: "custom_hierarchy",
|
||||
},
|
||||
custom_path_tree_reversed: {
|
||||
tokenizer: "custom_hierarchy_reversed",
|
||||
},
|
||||
},
|
||||
tokenizer: {
|
||||
custom_hierarchy: {
|
||||
type: "path_hierarchy",
|
||||
delimiter: "/",
|
||||
},
|
||||
custom_hierarchy_reversed: {
|
||||
type: "path_hierarchy",
|
||||
delimiter: "/",
|
||||
reverse: "true",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
mappings: {
|
||||
properties: {
|
||||
file_path: {
|
||||
type: "text",
|
||||
fields: {
|
||||
tree: {
|
||||
type: "text",
|
||||
analyzer: "custom_path_tree",
|
||||
},
|
||||
tree_reversed: {
|
||||
type: "text",
|
||||
analyzer: "custom_path_tree_reversed",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
|
||||
const response1 = await client.index({
|
||||
index: "file-path-test",
|
||||
id: 1,
|
||||
document: {
|
||||
file_path: "/User/alice/photos/2017/05/16/my_photo1.jpg",
|
||||
},
|
||||
});
|
||||
console.log(response1);
|
||||
|
||||
const response2 = await client.index({
|
||||
index: "file-path-test",
|
||||
id: 2,
|
||||
document: {
|
||||
file_path: "/User/alice/photos/2017/05/16/my_photo2.jpg",
|
||||
},
|
||||
});
|
||||
console.log(response2);
|
||||
|
||||
const response3 = await client.index({
|
||||
index: "file-path-test",
|
||||
id: 3,
|
||||
document: {
|
||||
file_path: "/User/alice/photos/2017/05/16/my_photo3.jpg",
|
||||
},
|
||||
});
|
||||
console.log(response3);
|
||||
|
||||
const response4 = await client.index({
|
||||
index: "file-path-test",
|
||||
id: 4,
|
||||
document: {
|
||||
file_path: "/User/alice/photos/2017/05/15/my_photo1.jpg",
|
||||
},
|
||||
});
|
||||
console.log(response4);
|
||||
|
||||
const response5 = await client.index({
|
||||
index: "file-path-test",
|
||||
id: 5,
|
||||
document: {
|
||||
file_path: "/User/bob/photos/2017/05/16/my_photo1.jpg",
|
||||
},
|
||||
});
|
||||
console.log(response5);
|
||||
----
|
||||
Reference in New Issue
Block a user