elastic search 安装,启动总结
elastic search 安装,启动
-
下载地址https://repo.huaweicloud.com/elasticsearch/7.14.0/
-
解压,新建用户【es 不能以 root 启动】tar -xf useradd es
-
修改配置
-
根据自身内存【free -h】修改启动内存config/jvm.options
-Xms128m
-Xmx128m -
如果需要外部也能访问config/elasticsearch.yml
network.host: 0.0.0.0
cluster.initial_master_nodes: ["node-1"] -
去除 geo 更新ingest.geoip.downloader.enabled: false
-
启动时报错 vm.max_map_count 太小/etc/sysctl.confvm.max_map_count = 262144
知识点总结
1.数据类型
-
字符串:keyword (不可分词), text
-
数字: integer long
-
bool: boolean
-
日期: date
2. API
映射
-
-
查看 es 索引
GET /_cat/indices
-
创建索引
PUT /index
{
"settings":{
"number_of_replicas": 0,
"number_of_shards": 1
},
"mappings":{
"id":{
"type":"text"
}
}
} -
删除索引
DELETE /index
-
查看索引映射 (映射信息不允许删除修改)
GET /index/_mapping
文档
-
创建
POST /index/_doc/id
POST /index/_doc
-
查询
GET /index/_doc/id
-
删除
DELETE /index/_doc/id
-
更新
PUT /index/_doc/id 【删除原始文档】
{
"id": 1
}POST /index/_doc/id/_update 【不会删除原始文档】
{
"doc":{
"id": 1
}
}

浙公网安备 33010602011771号