[[returning-suggesters-type]]
=== Returning the type of the suggester

Sometimes you need to know the exact type of a suggester in order to parse its results. The `typed_keys` parameter
 can be used to change the suggester's name in the response so that it will be prefixed by its type.

Considering the following example with two suggesters `term` and `phrase`:

[source,js]
--------------------------------------------------
POST _search?typed_keys
{
  "suggest": {
    "text" : "some test mssage",
    "my-first-suggester" : {
      "term" : {
        "field" : "message"
      }
    },
    "my-second-suggester" : {
      "phrase" : {
        "field" : "message"
      }
    }
  }
}
--------------------------------------------------
// CONSOLE
// TEST[setup:twitter]

In the response, the suggester names will be changed to respectively `term#my-first-suggester` and
`phrase#my-second-suggester`, reflecting the types of each suggestion:

[source,js]
--------------------------------------------------
{
  "suggest": {
    "term#my-first-suggester": [ <1>
      {
        "text": "some",
        "offset": 0,
        "length": 4,
        "options": []
      },
      {
        "text": "test",
        "offset": 5,
        "length": 4,
        "options": []
      },
      {
        "text": "mssage",
        "offset": 10,
        "length": 6,
        "options": [
          {
            "text": "message",
            "score": 0.8333333,
            "freq": 4
          }
        ]
      }
    ],
    "phrase#my-second-suggester": [ <2>
      {
        "text": "some test mssage",
        "offset": 0,
        "length": 16,
        "options": [
          {
            "text": "some test message",
            "score": 0.030227963
          }
        ]
      }
    ]
  },
  ...
}
--------------------------------------------------
// TESTRESPONSE[s/\.\.\./"took": "$body.took", "timed_out": false, "_shards": "$body._shards", "hits": "$body.hits"/]

<1> The name `my-first-suggester` now contains the `term` prefix.
<2> The name `my-second-suggester` now contains the `phrase` prefix.