Get tokens from text analysis
The analyze API performs analysis on a text string and returns the resulting tokens.
Path parameters
-
Index used to derive the analyzer. If specified, the
analyzer
or field parameter overrides this value. If no index is specified or the index does not have a default analyzer, the analyze API uses the standard analyzer.
Body
-
analyzer string
The name of the analyzer that should be applied to the provided
text
. This could be a built-in analyzer, or an analyzer that’s been configured in the index. -
attributes array[string]
Array of token attributes used to filter the output of the
explain
parameter. -
char_filter array
Array of character filters used to preprocess characters before the tokenizer.
-
explain boolean
If
true
, the response includes token attributes and additional details. -
field string
Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.
-
filter array
Array of token filters used to apply after the tokenizer.
-
normalizer string
Normalizer to use to convert text into a single token.
text string | array[string]
curl \
-X POST http://api.example.com/{index}/_analyze \
-H "Content-Type: application/json" \
-d '"{\n \"analyzer\" : \"standard\",\n \"text\" : \"Quick Brown Foxes!\"\n}"'
{
"analyzer" : "standard",
"text" : "Quick Brown Foxes!"
}
{
"detail": {
"analyzer": {
"name": "string",
"tokens": [
{
"bytes": "string",
"end_offset": 42.0,
"keyword": true,
"position": 42.0,
"positionLength": 42.0,
"start_offset": 42.0,
"termFrequency": 42.0,
"token": "string",
"type": "string"
}
]
},
"charfilters": [
{
"filtered_text": [
"string"
],
"name": "string"
}
],
"custom_analyzer": true,
"tokenfilters": [
{
"name": "string",
"tokens": [
{
"bytes": "string",
"end_offset": 42.0,
"keyword": true,
"position": 42.0,
"positionLength": 42.0,
"start_offset": 42.0,
"termFrequency": 42.0,
"token": "string",
"type": "string"
}
]
}
],
"tokenizer": {
"name": "string",
"tokens": [
{
"bytes": "string",
"end_offset": 42.0,
"keyword": true,
"position": 42.0,
"positionLength": 42.0,
"start_offset": 42.0,
"termFrequency": 42.0,
"token": "string",
"type": "string"
}
]
}
},
"tokens": [
{
"end_offset": 42.0,
"position": 42.0,
"positionLength": 42.0,
"start_offset": 42.0,
"token": "string",
"type": "string"
}
]
}