随笔分类 -  03_ElasticSearch

摘要:Elasticsearch 提供了多种模糊查询方式,适用于不同场景的需求。以下是主要实现方式及其核心特点: 查询类型 适用场景 核心特点 性能影响 Wildcard 通配符匹配(*和?) 类似 SQL 的 LIKE,支持任意位置的通配符,但以*开头时性能较差。适用于非分词的 keyword 类型字段 阅读全文
posted @ 2025-02-08 13:48 翠微 编辑
摘要:1、添加、修改、删除时注意刷新策略 RefreshPolicy,尽量不要立即刷新 WriteRequest.RefreshPolicy.IMMEDIATE 2、分片数量根据实际机器数量确定 阅读全文
posted @ 2024-07-19 11:05 翠微 编辑
摘要:REST API { "query": { "bool": { "must": [ { "term": { "sqStatus": { "value": 3, "boost": 1 } } }, { "script": { "script": { "source": "if (doc['finish 阅读全文
posted @ 2024-01-31 15:53 翠微 编辑
摘要:REST API Java Client BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery(); boolQueryBuilder.must(QueryBuilders.termQuery("enable", 1)); final 阅读全文
posted @ 2024-01-03 11:35 翠微 编辑
摘要:文档删除 1、单个删除文档 REST API DELETE myindex/_doc/1 Java REST Client 2、批量删除文档 REST API POST myindex/_delete_by_query { "query": { "bool": { "must": [ { "term 阅读全文
posted @ 2023-11-11 10:46 翠微 编辑
摘要:文档更新 1、单个 2、批量 阅读全文
posted @ 2023-11-11 10:45 翠微 编辑
摘要:创建空索引 PUT myindex { "settings": { "number_of_shards": 1, "number_of_replicas": 1 }, "mappings": { "properties": { "name": { "type": "keyword", "ignore 阅读全文
posted @ 2023-11-11 10:44 翠微 编辑
摘要:【ElasticSearch】索引(删除) 阅读全文
posted @ 2023-06-17 16:18 翠微 编辑
摘要:增加字段 REST API 文档:https://www.elastic.co/guide/en/elasticsearch/reference/7.13/docs-reindex.html 准备一个空索引myindex PUT /myindex { "settings": { "number_of 阅读全文
posted @ 2023-06-17 16:18 翠微 编辑
摘要:1、REST API 文档:https://www.elastic.co/guide/en/elasticsearch/reference/7.13/indices-create-index.html ignore_above 默认值 256 settings 中的index可以去掉 "settin 阅读全文
posted @ 2023-06-17 16:17 翠微 编辑
摘要:【ElasticSearch】数据类型 阅读全文
posted @ 2023-04-03 21:44 翠微 编辑
摘要:【ElasticSearch】聚合Aggregation 关于text类型默认是禁止聚合/排序操作的,通过 fielddata=true 开启 PUT cms_search_inside_0d1a60ff-654d-4c1d-9d92-795ff0f9/_mapping { "properties" 阅读全文
posted @ 2023-01-06 09:55 翠微 编辑
摘要:【ElasticSearch】检索文档 阅读全文
posted @ 2022-08-23 15:30 翠微 编辑
摘要:【ElasticSearch】删除文档 删除单个文档 DELETE get-together/_doc/1 根据条件删除文档 POST get-together/_delete_by_query { "query": { "bool": { "must": [ { "term": { "age": 阅读全文
posted @ 2022-08-23 15:29 翠微 编辑
摘要:1、根据ID更新文档 1、根据ID更新文档 rest POST myindex/_update/1 { "doc": { "name": "Smith" } } client // 数据 Map<String, String> data = new HashMap<>(); data.put("na 阅读全文
posted @ 2022-08-23 15:29 翠微 编辑
摘要:1、查询别名 查询所有 GET /_alias 查询单个 GET /admin-service/_alias 2、创建别名 批量创建 POST /_aliases { "actions": [ { "add": { "index": "admin-service", "alias": "admin- 阅读全文
posted @ 2022-08-16 11:32 翠微 编辑
摘要:1、创建策略【保留日志天数】 2、填写策略名称和其他配置 热阶段,最大存在时间 3 天 可再编辑策略 3、日志索引关联策略 选择自己新建的生命周期策略 阅读全文
posted @ 2022-08-16 10:59 翠微 编辑
摘要:TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block 磁盘使用量超过洪泛阶段水印,索引具有只读允许删除块 解决:扩充磁盘,重启ES 给磁盘扩容后关闭 阅读全文
posted @ 2022-07-30 22:16 翠微 编辑
摘要:【ElasticSearch】去掉重复数据 https://blog.csdn.net/qq_33697094/article/details/109735592 https://blog.csdn.net/qq_33697094/article/details/109735592 https:// 阅读全文
posted @ 2022-07-28 15:00 翠微 编辑
摘要:【ElasticSearch】使用 curl 查询 curl命令文档 http://www.ruanyifeng.com/blog/2019/09/curl-reference.html 查看索引 curl -XGET http://localhost:9200/_cat/indices 查看集群健 阅读全文
posted @ 2021-11-25 13:26 翠微 编辑

点击右上角即可分享
微信分享提示