ES常用指令
10.119.185.174:9200
curl '10.119.185.174:9200/_cat/indices?v' --header 'auth_user;' --header 'auth_password: elastic' --header 'Authorization: Basic ZWxhc3RpYzpVbExZdTU4NjcwOFI3QWZDUTk5NkZMTmE='
查询索引列表
GET _cat/indices
指定索引查询
GET collect_task/_search
{
"query": {
"query_string": {
"default_field":"name",
"query": "1636716413111"
}
}
}
指定索引对数据内容求和
GET collect_task_fruit/_search
{
"size":0
, "query":
{
"bool":
{ "must":
[{"term":
{"planProjectId":{"value":1,"boost":1.0}}
},
{"term":
{"id":{"value":3289,"boost":1.0}}
}
]
,"adjust_pure_negative":true
,"boost":1.0
}
}
}
向/Index/Type/Id发出 GET 请求,就可以查看这条记录。
GET collect_task_fruit/_doc/3289
{
}
带用户密码
curl --user elastic:elastic '10.216.7.51:9200/_cat/indices'
创建索引
collect_task
collect_task_fruit
package_submit_inspection
collect_task_flow
package_indoor_submit
curl -v -u elastic:elastic --header "Content-Type: application/json;charset=UTF-8" -X PUT 10.216.7.51:9200/package_indoor_submit --data '{
"mappings": {
"dynamic_templates": [
{
"integers": {
"match_mapping_type": "long",
"mapping": {
"type": "integer"
}
}
},
{
"strings": {
"match_mapping_type": "string",
"mapping": {
"type": "text",
"fields": {
"raw": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
]
}
}'