随笔分类 -  数据库 / 02-ES

摘要:## distinct 实现 1: > SELECT DISTINCT(user_id) FROM table WHERE user_id_type = 3; ``` { "query": { "term": { "user_id_type": 3 } }, "collapse": { "field 阅读全文
posted @ 2023-08-17 14:32 aaacarrot 阅读(1870) 评论(1) 推荐(1) 编辑
摘要:参数如下: ``` { "size": 10000, "query": { "bool": { "must": [ { "range": { "dateTime": { "from": "2022-09-21", "to": "2022-09-22", "include_lower": true, 阅读全文
posted @ 2023-08-05 16:01 aaacarrot 阅读(836) 评论(0) 推荐(0) 编辑
摘要:通过 Elasticsearch 的 RESTFul API 来创建索引: PUT http://{host}:9200/{index} > 默认情况下,创建的索引分片数量是 5 个,副本数量是 1 个。 如果要指定分片数、副本数量: ``` { "settings": { "number_of_s 阅读全文
posted @ 2023-08-05 15:35 aaacarrot 阅读(261) 评论(0) 推荐(0) 编辑
摘要:1、term 查询是基于字段的精确匹配查询,不应用分词器。 match 查询是全文搜索查询,对搜索字符串和字段内容都应用相同的分词器,并使用布尔逻辑进行匹配。 2、match:会使用分词器,对全文进行匹配搜索(模糊搜索), 要注意的是,Keyword 不会做分词的。 所以如果是用在keyword上面 阅读全文
posted @ 2023-08-05 15:30 aaacarrot 阅读(1342) 评论(0) 推荐(0) 编辑
摘要:### 检查健康 curl http://10.11.12.123:9200/_cluster/health?pretty 通过这个去查看。 就会得到这么一个东西。。。 ``` { "cluster_name" : "es", "status" : "green", "timed_out" : fa 阅读全文
posted @ 2023-06-20 13:41 aaacarrot 阅读(55) 评论(0) 推荐(0) 编辑

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