* [docs] update readme and examples to use async/await * [apis] regenerate (including updated examples)
36 lines
531 B
Plaintext
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
|
|
// }
|
|
// ]
|
|
// }
|
|
// ]
|
|
// }
|
|
|
|
---------
|