1. 程式人生 > >Elasticsearch 系列指南(三)——整合ik分詞器

Elasticsearch 系列指南(三)——整合ik分詞器

{
    "tokens": [
        {
            "token": "聯",
            "start_offset": 0,
            "end_offset": 1,
            "type": "<IDEOGRAPHIC>",
            "position": 1
        },
        {
            "token": "想",
            "start_offset": 1,
            "end_offset": 2,
            "type": "<IDEOGRAPHIC>",
            "position": 2
        },
        {
            "token": "召",
            "start_offset": 2,
            "end_offset": 3,
            "type": "<IDEOGRAPHIC>",
            "position": 3
        },
        {
            "token": "回",
            "start_offset": 3,
            "end_offset": 4,
            "type": "<IDEOGRAPHIC>",
            "position": 4
        },
        {
            "token": "筆",
            "start_offset": 4,
            "end_offset": 5,
            "type": "<IDEOGRAPHIC>",
            "position": 5
        },
        {
            "token": "記",
            "start_offset": 5,
            "end_offset": 6,
            "type": "<IDEOGRAPHIC>",
            "position": 6
        },
        {
            "token": "本",
            "start_offset": 6,
            "end_offset": 7,
            "type": "<IDEOGRAPHIC>",
            "position": 7
        },
        {
            "token": "電",
            "start_offset": 7,
            "end_offset": 8,
            "type": "<IDEOGRAPHIC>",
            "position": 8
        },
        {
            "token": "源",
            "start_offset": 8,
            "end_offset": 9,
            "type": "<IDEOGRAPHIC>",
            "position": 9
        },
        {
            "token": "線",
            "start_offset": 9,
            "end_offset": 10,
            "type": "<IDEOGRAPHIC>",
            "position": 10
        }
    ]
}
由此可見自帶分詞器將其分成一個一個的字,這在我們使用過程中並不是很友好,因此ik分詞器相反是更好的選擇,那麼接下來我們就看看ik分詞器的安裝使用