header-H 'Content-Type: application/json'
index
PUT /blogs?pretty{"settings" : {"number_of_shards" : 1,"number_of_replicas" : 0,"refresh_interval": "1s"},"mappings": {"_doc": {"properties": {"title":{"type":"keyword"},"date": {"type": "date","format": "yyyy-MM-dd"}}}}}
mapping
已有索引的情况下,设置 mappings,不会影响已有的 mapping
PUT atest/_mapping/_doc{"properties": {"labels": {"type": "text","analyzer": "ik_max_word"}}}
设置时间类型映射(mapping)
format 常用格式
- yyyy-MM-dd
- epoch_millis 毫秒时间戳
- epoch_second 秒时间戳
- strict_date_optional_time||epoch_millis (multi)
- yyyy-MM-dd HH:mm:ss||epoch_second
alias
POST /_aliases{"actions": [{"remove": {"index": "index","alias": "index_2"}},{"add": {"index": "index","alias": "index_3","filter": {"term":{"flag": 1}}}}]}
