一、索引(Index)
1. 查看所有index: (_cat): GET /_cat/indices?v
2.查看my_index的mapping和setting的相关信息: GET /my_index?pretty
2. 创建index:
方式一:显式创建: 主要参数:settings、mappings,alaiase PUT /my_index { "settings": { ... any settings ... }, "mappings": { "type_one": { ... any mappings ... }, "type_two": { ... any mappings ... }, ... }, "aliases": { "shop": {} },
}
方式二:隐式操作:
直接向索引中插入一条文档即可,系统会根据文档包含的字段作为索引的映射,对索引的一些配置采用默认的配置来创建出来索引。
3.查看索引统计信息:(_stats)
- GET my_index/_stats
- GET my_index,another_index/_stats
- GET _all/_stats
4.删除索引:(_delete)
- DELETE /my_index
- DELETE /index_one,index_two
- DELETE /index_*
- DELETE /_all
- DELETE /*
1.列出 所有可以cat的命令 http://127.0.0.1:9200/_cat?
二、分析器:
1.查看某个字段数据的分词结果:GET /${index}/${type}/${id}/_termvectors?fields=${fields_name}
2. 分析:
POST _analyze
{
"char_filter" : ["html_strip"],
"tokenizer": "ik_smart",
"filter": [ "lowercase"],
"text": "38岁李小璐现身大学校园,热裤纤腰不输女学生,却被指素颜变化大",
"explain" : true
}