62 lines
1.0 KiB
Plaintext
62 lines
1.0 KiB
Plaintext
// This file is autogenerated, DO NOT EDIT
|
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
|
|
|
[source, js]
|
|
----
|
|
const response0 = await client.indices.create({
|
|
index: 'my_index',
|
|
body: {
|
|
mappings: {
|
|
properties: {
|
|
text: {
|
|
type: 'text',
|
|
fields: {
|
|
english: {
|
|
type: 'text',
|
|
analyzer: 'english'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
console.log(response0)
|
|
|
|
const response1 = await client.index({
|
|
index: 'my_index',
|
|
id: '1',
|
|
body: {
|
|
text: 'quick brown fox'
|
|
}
|
|
})
|
|
console.log(response1)
|
|
|
|
const response2 = await client.index({
|
|
index: 'my_index',
|
|
id: '2',
|
|
body: {
|
|
text: 'quick brown foxes'
|
|
}
|
|
})
|
|
console.log(response2)
|
|
|
|
const response3 = await client.search({
|
|
index: 'my_index',
|
|
body: {
|
|
query: {
|
|
multi_match: {
|
|
query: 'quick brown foxes',
|
|
fields: [
|
|
'text',
|
|
'text.english'
|
|
],
|
|
type: 'most_fields'
|
|
}
|
|
}
|
|
}
|
|
})
|
|
console.log(response3)
|
|
----
|
|
|