索引操作

Indices

Types

类型即对应了关系型数据库中表的地位,那么常见的基本操作也就包括了对于类型的创建 ( 类比于表创建 ) 与类型结构的修正 ( 类比于表结构修正 )。

// Creates an index called twitter with the message field in the tweet mapping type.
PUT twitter
{
  "mappings": {
    "tweet": {
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}
// Uses the PUT mapping API to add a new mapping type called user.
PUT twitter/_mapping/user
{
  "properties": {
    "name": {
      "type": "string"
    }
  }
}
// Uses the PUT mapping API to add a new field called user_name to the tweet mapping type.
PUT twitter/_mapping/tweet
{
  "properties": {
    "user_name": {
      "type": "string"
    }
  }
}

内置索引

_cat:

# cat paths
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_cat/indices
/_cat/indices/{index}
/_cat/segments
/_cat/segments/{index}
/_cat/count
/_cat/count/{index}
/_cat/recovery
/_cat/recovery/{index}
/_cat/health
/_cat/pending_tasks
/_cat/aliases
/_cat/aliases/{alias}
/_cat/thread_pool
/_cat/plugins
/_cat/fielddata
/_cat/fielddata/{fields}
上一页