首页 > 移动平台 > 详细

手动建立mapping以及增加属性

时间:2018-03-07 23:03:43      阅读:224      评论:0      收藏:0      [点我收藏+]

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

1、手动建立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": "not_analyzed"
        }
      }
    }
  }
}

2、增加mapping属性
PUT /website/_mapping/article
{
  "properties" : {
    "new_field" : {
      "type" : "string",
      "index": "not_analyzed"
    }
  }
}

3、测试mapping
GET /website/_analyze
{
  "field": "content",
  "text": "my-dogs"
}

手动建立mapping以及增加属性

原文:https://www.cnblogs.com/qinjf/p/8525468.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!