client.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
//         }
//       ]
//     }
//   ]
// }



Boolean — Whether specified concrete indices should be ignored when unavailable (missing or closed)


Boolean — Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)


String — Whether to expand wildcard expression to concrete indices that are open, closed or both.

  • "open"
  • "closed"
  • "none"
  • "all"


String — Specify the node or shard the operation should be performed on (default: random)


String — Specific routing value


String, String[], Boolean — A comma-separated list of index names to restrict the operation; use _all or empty string to perform the operation on all indices


Object, JSON — The request body, as either JSON or a JSON serializable object. See the elasticsearch docs for details about what can be specified here.

back to top