# es的使用

es使用教程：

<https://www.elastic.co/guide/cn/elasticsearch/guide/current/running-elasticsearch.html>

```shell
查索引：curl http://10.60.215.40:9200/_cat/indices?v
查索引里的数据：curl -XGET http://10.60.215.40:9200/label_log-v0-2021_01_13d/_search?pretty
删除索引：curl -X DELETE http://10.60.215.40:9200/label_log-v1-2021_01_01d 
刷新索引：curl -XPOST 10.60.215.40:9200/label_log-v1-2021_01_02d/_cache/clear?pretty
查询某一ip数据：curl -H 'content-Type:application/json' -XGET http://10.60.215.40:9200/label_log-v1-2021_01_19d/_search?pretty -d '{"query":{"match":{"srcIp":"14.204.2.1"}}}'
```

1.新建目录加索引：

```shell
curl -XPUT "http://10.222.10.73:9200/label_log-v0-2020_11_19d" -H 'Content-Type: application/json' -d '
{
   "settings":{
    "number_of_shards":3,
    "number_of_replicas":2
  },
  "mappings":{
    "properties":{
      "id":{"type":"long"},
      "name":{"type":"text"},
      "text":{"type":"text"}
    }
  }
}
```

2.新建和删除某个文档

```shell
curl -XDELETE "http://10.58.11.201:9200/label_log-v0-2020_11_18d"
curl -XPUT "http://10.58.11.201:9200/label_log-v0-2020_11_18d"
```

3.网页查看信


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://qiangrens-organization.gitbook.io/qkd90/shu-ju-ku-he-zhong-jian-jian/es-de-shi-yong.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
