Files
elasticsearch-js/docs/doc_examples/5271f4ff29bb48838396e5a674664ee0.asciidoc
2020-06-26 09:24:14 +02:00

66 lines
1018 B
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: {
city: {
type: 'text',
fields: {
raw: {
type: 'keyword'
}
}
}
}
}
}
})
console.log(response0)
const response1 = await client.index({
index: 'my_index',
id: '1',
body: {
city: 'New York'
}
})
console.log(response1)
const response2 = await client.index({
index: 'my_index',
id: '2',
body: {
city: 'York'
}
})
console.log(response2)
const response3 = await client.search({
index: 'my_index',
body: {
query: {
match: {
city: 'york'
}
},
sort: {
'city.raw': 'asc'
},
aggs: {
Cities: {
terms: {
field: 'city.raw'
}
}
}
}
})
console.log(response3)
----