上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 27 下一页
摘要: 1、数据准备 首先创建book索引 PUT /book/ { "settings": { "number_of_shards": 1, "number_of_replicas": 0 }, "mappings": { "properties": { "name": { "type": "text", 阅读全文
posted @ 2022-04-19 23:21 |旧市拾荒| 阅读(454) 评论(0) 推荐(0) 编辑
摘要: 1、Query DSL入门 1.1 DSL DSL:Domain Specified Language,特定领域的语言。es特有的搜索语言,可在请求体中携带搜索条件,功能强大。 查询全部 GET /book/_search { "query": { "match_all": {} } } 排序 GE 阅读全文
posted @ 2022-04-18 21:45 |旧市拾荒| 阅读(203) 评论(0) 推荐(1) 编辑
摘要: 1、什么是deep paging 根据相关度评分倒排序,所以分页过深,协调节点会将大量数据聚合分析。 2、deep paging 性能问题 1消耗网络带宽,因为所搜过深的话,各 shard 要把数据传递给 coordinate node,这个过程是有大量数据传递的,消耗网络。 2消耗内存,各 sha 阅读全文
posted @ 2022-04-17 22:50 |旧市拾荒| 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 1、multi-index 多索引搜索 多索引搜索就是一次性搜索多个index下的数据 /_search:所有索引下的所有数据都搜索出来 /index1/_search:指定一个index,搜索其下所有的数据 /index1,index2/_search:同时搜索两个index下的数据 /index 阅读全文
posted @ 2022-04-17 17:09 |旧市拾荒| 阅读(482) 评论(0) 推荐(0) 编辑
摘要: 1、搜索结果字段解析 首先插入一条测试数据 PUT /my_index/_doc/1 { "title": "2019-09-10" } 然后无条件搜索所有 GET my_index/_search 得到的结果 { "took" : 0, "timed_out" : false, "_shards" 阅读全文
posted @ 2022-04-06 21:51 |旧市拾荒| 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 1、写在前面 注意:导入的包区别,不同的包创建索引的方式不同。博主亲身实践,具体体现在createIndexRequest.mapping()里面。读者可自行试验。 import org.elasticsearch.client.indices.CreateIndexRequest; import 阅读全文
posted @ 2022-04-02 22:44 |旧市拾荒| 阅读(3578) 评论(0) 推荐(0) 编辑
摘要: 1、 中文分词器 1.1 默认分词器 先来看看ElasticSearch中默认的standard 分词器,对英文比较友好,但是对于中文来说就是按照字符拆分,不是那么友好。 GET /_analyze { "analyzer": "standard", "text": "中华人民共和国" } 我们想要 阅读全文
posted @ 2022-03-28 21:27 |旧市拾荒| 阅读(4254) 评论(0) 推荐(1) 编辑
摘要: 1、实时重建索引 在实际的生产环境中,一个field的设置是不能被修改的,如果要修改一个Field,那么应该重新按照新的mapping,建立一个index,然后将数据批量查询出来,重新用bulk api写入index中。 批量查询的时候,建议采用scroll api,并且采用多线程并发的方式来rei 阅读全文
posted @ 2022-03-26 23:01 |旧市拾荒| 阅读(425) 评论(0) 推荐(2) 编辑
摘要: 1、dynamic mapping ElasticSearch中有一个非常重要的特性——动态映射,即索引文档前不需要创建索引、类型等信息,在索引的同时会自动完成索引、类型、映射的创建。 当ES在文档中碰到一个以前没见过的字段时,它会利用动态映射(dynamic mapping)来决定该字段的类型,并 阅读全文
posted @ 2022-03-24 22:46 |旧市拾荒| 阅读(934) 评论(0) 推荐(0) 编辑
摘要: 1、type是什么 type,是一个index中用来区分类似的数据的。类似的数据,但是可能有不同的fields,而且有不同的属性来控制索引建立、分词器、field的value。 在底层的lucene中建立索引的时候,全部是opaque bytes类型,不区分类型的。 lucene是没有type的概念 阅读全文
posted @ 2022-03-24 20:44 |旧市拾荒| 阅读(1227) 评论(0) 推荐(0) 编辑
摘要: 1、默认的分词器 关于分词器,前面的博客已经有介绍了,链接:ElasticSearch7.3 学习之倒排索引揭秘及初识分词器(Analyzer)。这里就只介绍默认的分词器standard analyzer 2、 修改分词器的设置 首先自定义一个分词器es_std。启用english停用词token 阅读全文
posted @ 2022-03-22 22:31 |旧市拾荒| 阅读(531) 评论(0) 推荐(0) 编辑
摘要: 1、 为什么需要手动创建索引 直接put数据 PUT index/_doc/1,es会自动生成索引,并建立动态映射dynamic mapping。这样的话很大可能与实际的需求不服,在实际的应用上,我们需要自己手动建立索引和映射,这也是为了更好地管理索引。就像数据库的建表语句一样。 2、 创建索引 创 阅读全文
posted @ 2022-03-21 20:52 |旧市拾荒| 阅读(134) 评论(0) 推荐(1) 编辑
摘要: 1、mapping的核心数据类型以及dynamic mapping 1.1 核心的数据类型 string :text and keyword,byte,short,integer,long,float,double,boolean,date 详见:https://www.elastic.co/gui 阅读全文
posted @ 2022-03-19 23:14 |旧市拾荒| 阅读(459) 评论(0) 推荐(0) 编辑
摘要: 一、倒排索引 1. 构建倒排索引 例如说有下面两个句子doc1,doc2 doc1:I really liked my small dogs, and I think my mom also liked them. doc2:He never liked any dogs, so I hope th 阅读全文
posted @ 2022-03-18 23:19 |旧市拾荒| 阅读(413) 评论(0) 推荐(0) 编辑
摘要: 1.mapping映射 概念:自动或手动为index中的_doc建立的一种数据结构和相关配置,简称为mapping映射。插入几条数据,让es自动为我们建立一个索引 PUT /website/_doc/1 { "post_date": "2019-01-01", "title": "my first 阅读全文
posted @ 2022-03-14 22:06 |旧市拾荒| 阅读(219) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 27 下一页