一、增:
1 创建索引
1.1 创建单个索引并插入数据
POST http://SERVERIP:PORT/test/_doc
{
"account_number": 0,
"balance": 16623,
"firstname": "Bradshaw",
"lastname": "Mckenzie",
"age": 29,
"gender": "F",
"address": "244 Columbus Place",
"employer": "Euron",
"email": "bradshawmckenzie@euron.com",
"city": "Hobucken",
"state": "CO"
}
结果
{
"_index": "test",
"_type": "_doc",
"_id": "HUnvaZEBRgAADeLW2aE4",
"_version": 1,
"result": "created",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"_seq_no": 0,
"_primary_term": 1
}
1.2 直接创建索引并指定字段类型
PUT example
PUT example/docs/_mapping
{
"properties": {
"id": {"type": "long"},
"name": {"type": "text"},
"counter": {"type": "integer"},
"tags": {"type": "text"}
}
}
结果
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "example"
}