elasticsearch学习笔记
1:创建索引
curl -H "Content-Type:application/json" -XPOST http://localhost:9200/blog/article/ -d '{"title":"hello world"}'
备注:
使用put会报错,尚不知道是什么问题,以后可以研究一下。另外,H参数需要添加,否则索引创建会失败,参考书籍中相关知识点已经和当前使用的es版本不兼容,需要参考性的进行修改。
2:删除索引
curl -XDELETE http://localhost:9200/blog
3:映射配置
4:mapping类型定义
5:核心类型
- 字符串:string
- 数值:byte/short/interger/long/float/double
- 二进制:binary
- 日期:date
- 多字段
"name": {
"type": "string",
"fields": {
"facet": { "type" : "string", "index": "not_analyzed" }
}
}
- IP地址:ip
- token_count类型
6:分析器(暂时略,以后研究)
7:相似度模型(暂时略,以后研究)
8:信息格式(可以为字段指定信息存储、压缩格式)
9:文档值(可以为某些字段配置文档值,提高索引速度,该字段被存储在内存中,无需像标准字段一样进行倒排)
10:标识符字段
- _uid(由文档标识符和文档类型组成)
- _id
- _type
- _all
- _source
- _index
- _size
- _timestamp
- _ttl
11:段合并(暂时略,以后研究)
12:路由设置(索引过程)
13:路由字段
//Todo Continue
参考书籍:《Elasticsearch服务器开发》
编者按:《Elasticsearch服务器开发》第二版有点太老了,很多知识点都有所变动,不推荐使用该参考书籍。
权威指南:https://elasticsearch.cn/book/elasticsearch_definitive_guide_2.x/getting-started.html