1.创建索引,名字为index
1 | curl -XPUT http://localhost:9200/index |
2.创建一个mapping
1 | curl -XPOST http://localhost:9200/index/fulltext/_mapping -H 'Content-Type:application/json' -d' |
3.查看mapping
1 | curl -XPUT http://localhost:9200/xxx/yyy/_mapping |
4.删除一个文档,按照id来删除
1 | curl -XDELETE 'http://localhost:9200/index3/fulltext3/272' |
5.通过query来删除文档
不同版本之间的es不太一样,6.2的参考
1 | https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-delete-by-query.html |
比如使用kibana里面的dev tool,就可以删掉所有schema字段是“xxxx”的数据
1 | POST xxxxx_2019-12-09/_delete_by_query |
6.es的task api,参考
1 | http://xiaorui.cc/archives/3089 |
7.scroll查看数据,from+size查询最多只能查10000
参考:https://www.elastic.co/guide/en/elasticsearch/reference/6.8/search-request-scroll.html
1 | curl -XPOST -H 'Content-Type: application/json' http://localhost:9200/_search/scroll -d@data.json |
data.json
1 | { |
8.删除一个索引
1 | curl -XDELETE http://ip:port/xxxx |