Menu

1.2 Elasticsearch 索引集群的管理

2017年6月12日 - Elasticsearch

课程环境


Elasticsearch 介绍

Elasticsearch 索引简单操作

Kibana Dev Tools

Elasticsearch 索引较复杂操作

PUT /order_index
{
  "settings": {
    "index": {
      "number_of_shards": 5,
      "number_of_replicas": 1
    }
  }
}
PUT /order_index/_settings
{
    "number_of_replicas": 2
}
PUT /product_index
{
  "settings": {
    "refresh_interval": "5s",
    "number_of_shards": 5,
    "number_of_replicas": 1
  },
  "mappings": {
    "product": {
      "properties": {
        "id": {
          "type": "text",
          "index": "not_analyzed"
        },
        "product_name": {
          "type": "text",
          "store": "no",
          "term_vector": "with_positions_offsets",
          "analyzer": "ik_max_word",
          "search_analyzer": "ik_max_word",
          "boost": 5
        },
        "product_desc": {
          "type": "text",
          "index": "not_analyzed"
        },
        "price": {
          "type": "double",
          "index": "not_analyzed"
        },
        "created_date_time": {
          "type": "date",
          "index": "not_analyzed",
          "format": "basic_date_time"
        },
        "last_modified_date_time": {
          "type": "date",
          "index": "not_analyzed",
          "format": "basic_date_time"
        },
        "version": {
          "type": "long",
          "index": "no"
        }
      }
    }
  }
}
标签: