索引类似数据库,mapping 定义字段类型。

本节要点

  • PUT 创建索引
  • mapping 定义字段
  • text 用于全文检索

代码示例

PUT /articles
{
  "mappings": {
    "properties": {
      "title": { "type": "text" },
      "views": { "type": "integer" }
    }
  }
}