Files
elasticsearch-js/docs/_examples/suggest.asciidoc
Spencer 83a464ac66 Update docs to use async/await (#667)
* [docs] update readme and examples to use async/await

* [apis] regenerate (including updated examples)
2018-05-23 14:31:34 -07:00

36 lines
531 B
Plaintext

.Return query terms suggestions (“auto-correction”)
[source,js]
---------
const response = await client.suggest({
index: 'myindex',
body: {
mysuggester: {
text: 'tset',
term: {
field: 'title'
}
}
}
});
// response will be formatted like so:
//
// {
// ...
// mysuggester: [
// {
// text: "tset",
// ...
// options: [
// {
// text: "test",
// score: 0.75,
// freq: 5
// }
// ]
// }
// ]
// }
---------