查询命令
match
GET 索引名称/_search
{
"query": {
"match": {
"字段名称": "xxxx"
}
}
}
terms
GET 索引名称/_search
{
"query": {
"terms": {
"字段名称": [
"8986112127603554579",
"1585441384517906433"
]
}
}
}
wildcard
GET 索引名称/_search
{
"query": {
"wildcard": {
"字段名称": {
"value": "*1597474927485931522*"
}
}
}
}
查询映射
GET 索引名称/_mapping
{}
删除命令
删除索引
DELETE 索引名称
根据查询条件删除数据
POST 索引名称/_delete_by_query?slices=auto&conflicts=proceed&wait_for_completion=false
{
"query": {
"terms": {
"索引字段": [
"xxxx1",
"xxxxx2"
]
}
}
}
创建命令
创建索引
PUT 索引名称
{
"mappings": {
"properties": {
"create_date": {
"type": "date"
},
"customer_id": {
"type": "long"
},
"customer_name": {
"type": "keyword",
"ignore_above": 256
},
"iccid": {
"type": "keyword",
"ignore_above": 256
},
"id": {
"type": "keyword",
"ignore_above": 256
},
"principal_id": {
"type": "long"
},
"principal_name": {
"type": "keyword",
"ignore_above": 256
},
"real_usage": {
"type": "float"
},
"type": {
"type": "long"
},
"vanity_usage": {
"type": "float"
}
}
}
}
创建索引字段
PUT 索引名称/_mapping
{
"properties": {
"code": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
修改
修改关键字长度
PUT 索引名称/_mapping/_doc?include_type_name=true
{
“properties”: {
“字段名称”: {
“type”:“keyword”,
“ignore_above”:512
}
}
}
迁移数据
POST _reindex
{
"source": {
"index": "原索引"
},
"dest": {
"index": "新索引"
}
}