赞
踩
点击进入es的查询页面;
点击进入es的索引表管理页面;
# 修改索引的read_only选项
PUT media_type/_settings
{
"index": {
"blocks": {
"read_only_allow_delete": "false"
}
}
}
# 修改所有索引的read_only选项
PUT _all/_settings { "index.blocks.read_only_allow_delete": null }
curl方式:
curl -XPUT -H "Content-Type: application/json" http://10.2.7.70:9204/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'
PUT /_cluster/settings{ "persistent" : { "cluster.blocks.read_only" : false } }
# 添加字段
PUT media/_mapping
{
"properties": {
"searchMediaType": {
"type": "keyword"
}
}
}
注:mapping无法删除;
# 检索并排序
GET media/_search
{
"size":20,
"query": {
"match": {
"sourceType": "CTC"
}
},
"sort": [
{
"createTime": {
"order": "desc"
}
}
]
}
# 条件删除
POST media/_delete_by_query
{
"query":{
"match":{
"code" : "02000000000000072020100500016975"
}
}
}
# 删除别名
DELETE secisland3/_alias/secisland3_alias_beijing
# 添加别名
POST _aliases
{
"actions": [
{
"add": {
"index": "secisland",
"alias": "secisland_alias"
}
}
]
}
多条件查询:
GET media/_search
{
"size":20,
"query": {
"bool": {
"must": [
{"match":
{
"sourceType": "CTC"
}
}
]
}
},
"sort": [
{
"createTime": {
"order": "desc"
}
}
]
}
#修改索引的某个字段值
POST media/_update/CMCC_02000000000000100000000000213643
{
"doc" : {
"status": 0
}
}
# 选择分词器
GET _analyze {
"analyzer": "ik_max_word",
"text": ["张思琪"]
}
命令行查询elastic-search状态:
curl --user elastic:admin123 172.29.212.42:8100/_cluster/health?pretty
ES教程:
https://www.cnblogs.com/lwx57280/p/13738230.html
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。