听课笔记(63讲—65讲)

第63讲

type就是index中用来区分数据的

所有的字,在Lucene中存储的时候,都是按照二进制码的形式存储的。

一个index下不可以有多个type重名

第64讲

properties是用来配置type中有多少个field(type,index,analyzer)

type就是配置field的类型

index配置要不要分词

analyzer来配置适用于那个分词器

 

PUT /my_indexs
{
  "mappings": {
    "my_type":{
      "_source": {
        "enabled": false
      }
    }
  }
}

PUT /my_index/_mapping/my_test
{
  "_source": {
    "enabled": false
  }
}
PUT /my_index/_mapping/my_test2
{
  "properties": {
    "my_field":{
      "type": "text",
      "include_in_all": false
    }
  }
}
PUT /my_index/_mapping/my_test1
{
  "_all": {
    "enabled": false
  }
}

第65讲:dynamic的设置

PUT /my
{
  "mappings": {
    "my_type":{
      "dynamic":"strict",
      "properties": {
        "title":{
          "type": "string"
        },
        "stash":{
          "type": "object",
          "dynamic":true
        }
        }
    }
  }
}

PUT /my/my_type/1
{
  "title":" this docc adds a new field",
  "stash":{
    "new_field":"success"
  }
}

PUT /my/my_type/1
{
  "title":"this throws a strictdynamicMappingexception",
  "new_field":"Fail!"
}
DELETE /my

 

content是一个陌生字段,是不允许的。

这就是定制化dynamic的策略

 

 

猜你喜欢

转载自blog.csdn.net/wyqwilliam/article/details/82959559