_analyze is a very useful Elasticsearch API that can help you analyze how each field or a analyzer/tokenizer analyzes and indexes a text.
Returns the result field meaning: token is a word that is actually stored in the index position indicates the number of occurrences of the Start_offset and End_offset in the original text, where the word occupies the original text.
1, the default analyzer get/_analyze?
{"Analyzer": "Standard", "text": "Bed before the Moon Light"} { "tokens": [ { "token": "Bed", "Start_offset": 0, &NB Sp "End_offset": 1, "type": "<IDEOGRAPHIC>", "position": 0 &nbs P }, { "token": "Pre", "Start_offset": 1, "end_of" Fset ": 2, " type ":" <IDEOGRAPHIC> ", " position ": 1 }, & nbsp { "token": "Ming", "Start_offset": 2, "End_offset": 3, "type": "<IDEOGRAPHIC>" "position": 2 }, { &NBsp "token": "Month", "Start_offset": 3, "End_offset": 4, "T Ype ": <IDEOGRAPHIC>" "position": 3 }, { Tok En ": Light" "Start_offset": 4, "End_offset": 5, "type": "< Ideographic> ", " position ": 4 } } 2, you can also use the specified analyzer to analyze using Whitspace get/_anal
Yze?
{ "analyzer": "Whitespace", "text": "Bright Moonlight Before Bed"} { "tokens": [ { "token": "Pre-bed", "Start_offset": 0, &N Bsp "End_offset": 2, "type": "word", "position": 0 }, &N Bsp { "token": "Moon Light", "Start_offset": 3, "End_offset": 6, &NBSP ; "type": "word", "PositioN ": 1 } } 3, using IK Analyzer get/tystock/_analyze?
{ "Analyzer": "Ik_max_word", "text": "Bright Moonlight Before Bed"} { "tokens": [ { "token": "The bright Moonlight before the bed", "Start_offset": 0, "End_offset": 5, "type": "Cn_word", "position": 0 } , { "token": "Bed before", "Start_offset": 0, "end_of" Fset ": 2 " type ":" Cn_word ", " position ": 1 }, {&nbs P "token": "Moon Light", "Start_offset": 2, "End_offset": 5, "type": "Cn_word" "position": 2 }, { "token" : "Moon", "Start_offset": 2, "End_offset": 4, "type": "Cn_wor D ", &NBSP "position": 3 }, { "token": "Ming", "START_OFFSE" T ": 2, " End_offset ": 3, " type ":" Cn_word ", " position ": 4 &N Bsp }, { "token": "Moonlight", "Start_offset": 3, "End_offset": 5 "type": "Cn_word", "position": 5 }, &NBSP ; { "token": "Month", "Start_offset": 3, "End_offset": 4, "type": "Cn_word", "position": 6 }, { "token": "Light" "Start_offset": 4, "End_offset": 5, "type": "
Cn_char ", " position ": 7 } ] 4, using phonetic Analyzer Get/tystock/_analyze?
{ "analyzer": "Pinyin", "text": "Bed before the Moon Light"} { "tokens": [ { "token": "Chuang", &NBSP ; "Start_offset": 0, "End_offset": 1, "type": "word", Positi On ": 0 }, { " token ":" Cqmyg ", " Start_offset ": 0, &NB Sp "End_offset": 5, "type": "word", "position": 0 }, &N Bsp { "token": "Qian", "Start_offset": 1, "End_offset": 2, "type": "word", "position": 1 }, { "token": "Ming", "Start_offset": 2, "End_offset": 3,
"Type": "word" "position": 2 }, { "token": "Yue", "Start_offset": 3, "End_offset": 4, "type": "word", "Position": 3 }, { "token": "Guang", "Start_offset" : 4, "End_offset": 5, "type": "word", "position": 4
} ]}