添加索引
如果只是简单的使用索引,那么可以利用默认的设置。
如果响应自己手动编写复杂的索引,则可通过修改config/elasticsearch.yml文件
action.auto_create_index:false
来禁止自动创建索引。
创建索引使用PUT,如:
PUT /my_index
{
"settings": { ... },
"mappings": {
"type_one": { ... },
"type_two": { ... },
...
}
删除索引
删除索引使用DELETE ,如:
DELETE /index_one,index_two
DELETE /index_*
自定义索引
自定义索引时需要注意主分片和复制分片的设置。
number_of_shards
number_of_replicas
如下:
PUT /my_temp_index
{
"settings": {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
}
分析器设置
PUT /spanish_docs
{
"settings": {
"analysis": {
"analyzer": {
"es_std": {
"type": "standard",
"stopwords": "_spanish_"
}
}
}
}
}
本文详细介绍如何在Elasticsearch中进行索引管理,包括创建、删除及自定义索引的过程,同时深入探讨了索引配置参数的重要性,如主分片和复制分片的设置,以及如何定制分析器以满足特定需求。
6268

被折叠的 条评论
为什么被折叠?



