一、如何建立索引
    analyzed:分词
    not_analyzed:分词
    no:不能被索引和搜索

    二、修改mapping
    只能创建index时手动建立mapping,或者新增field mapping,但是不能update field mapping

    PUT /website
    {
    “mappings”: {
    “article”:{
    “properties”: {
    “author_id”:{
    “type”: “long”
    },
    “title”:{
    “type”: “text”,
    “analyzer”: “english”
    },
    “content”:{
    “type”: “text”
    },
    “post_date”:{
    “type”: “date”
    },
    “publisher_id”:{
    “type”: “text”,
    “index”: false
    }
    }
    }
    }
    }

    对已经存在的字段进行修改,会提示已经存在。
    但是可以进行新增field操作。

    三、测试mapping

    GET /website/_analyze
    {
    “field”: “content”,
    “text”: “a dog”
    }

    结果:

    {
    “tokens”: [
    {
    “token”: “a”,
    “start_offset”: 0,
    “end_offset”: 1,
    “type”: ““,
    “position”: 0
    },
    {
    “token”: “dog”,
    “start_offset”: 2,
    “end_offset”: 5,
    “type”: ““,
    “position”: 1
    }
    ]
    }