IMPORTANT: elasticsearch.js has been replaced by the new Elasticsearch JavaScript client. We strongly advise you to migrate to the new client. To learn more, see the migration guide.
suggest
editsuggest
editclient.suggest([params, [callback]])
The suggest feature suggests similar looking terms based on a provided text by using a specific suggester.
Check the API Conventions and the elasticsearch docs for more information pertaining to this method.
Return query terms suggestions (“auto-correction”).
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
// }
// ]
// }
// ]
// }
Params
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|