随笔分类 -  ES-学习

摘要:课程大纲 1、multivalue field { "tags": [ "tag1", "tag2" ]} 建立索引时与string是一样的,数据类型不能混 2、empty field null,[],[null] 3、object field PUT /company/employee/1 { " 阅读全文
posted @ 2024-10-02 00:03 5765809 阅读(11) 评论(0) 推荐(0)
摘要:1、核心的数据类型 string byte,short,integer,long float,double boolean date 2、dynamic mapping 根据field的值,对值的类型进行推断,比如 true 或者 false 就会推断成 boolean类型 true or fals 阅读全文
posted @ 2024-10-02 00:03 5765809 阅读(10) 评论(0) 推荐(0)
摘要:1、如何建立索引 analyzed:可以被分次 not_analyzed:不可以被分次 no:不可以被搜索到 2、修改mapping 只能创建index时手动建立mapping,或者新增field mapping,但是不能update field mapping PUT /website { "ma 阅读全文
posted @ 2024-10-02 00:03 5765809 阅读(13) 评论(0) 推荐(0)
摘要:(1)往es里面直接插入数据,es会自动建立索引,同时建立type以及对应的mapping (2)mapping中就自动定义了每个field的数据类型 (3)不同的数据类型(比如说text和date),可能有的是exact value,有的是full text (4)exact value,在建立倒 阅读全文
posted @ 2024-10-02 00:02 5765809 阅读(12) 评论(0) 推荐(0)
摘要:1、query string分词 query string必须以和index建立时相同的analyzer进行分词 query string对exact value和full text的区别对待 date:exact value _all:full text 比如我们有一个document,其中有一个 阅读全文
posted @ 2024-10-02 00:02 5765809 阅读(26) 评论(0) 推荐(0)
摘要:1、什么是分词器 切分词语,normalization(提升recall召回率) 给你一段句子,然后将这段句子拆分成一个一个的单个的单词,同时对每个单词进行normalization(时态转换,单复数转换),分瓷器 recall,召回率:搜索的时候,增加能够搜索到的结果的数量 character f 阅读全文
posted @ 2024-10-02 00:01 5765809 阅读(23) 评论(0) 推荐(0)
摘要:doc1:I really liked my small dogs, and I think my mom also liked them. doc2:He never liked any dogs, so I hope that my mom will not expect me to liked 阅读全文
posted @ 2024-10-01 20:15 5765809 阅读(28) 评论(0) 推荐(0)
摘要:1、exact value 必须要精确匹配才可以搜索出来 2017-01-01,exact value,搜索的时候,必须输入2017-01-01,才能搜索出来 如果你输入一个01,是搜索不出来的 2、full text 类似模糊匹配 (1)缩写 vs. 全程:cn vs. china (2)格式转化 阅读全文
posted @ 2024-10-01 20:15 5765809 阅读(31) 评论(0) 推荐(0)
摘要:1、query string基础语法 GET /test_index/test_type/_search?q=test_field:test GET /test_index/test_type/_search?q=+test_field:test GET /test_index/test_type/ 阅读全文
posted @ 2024-10-01 20:14 5765809 阅读(39) 评论(0) 推荐(0)
摘要:插入几条数据,让es自动为我们建立一个索引 PUT /website/article/1 { "post_date": "2017-01-01", "title": "my first article", "content": "this is my first article in this we 阅读全文
posted @ 2024-10-01 20:14 5765809 阅读(20) 评论(0) 推荐(0)
摘要:课程大纲 1、讲解如何使用es进行分页搜索的语法 size,from GET /_search?size=10 GET /_search?size=10&from=0 GET /_search?size=10&from=20 分页的上机实验 GET /test_index/test_type/_se 阅读全文
posted @ 2024-10-01 20:09 5765809 阅读(19) 评论(0) 推荐(0)
摘要:课程大纲 1、multi-index和multi-type搜索模式 告诉你如何一次性搜索多个index和多个type下的数据 /_search:所有索引,所有type下的所有数据都搜索出来 /index1/_search:指定一个index,搜索其下所有type的数据 /index1,index2/ 阅读全文
posted @ 2024-10-01 20:07 5765809 阅读(69) 评论(0) 推荐(0)
摘要:课程大纲 1、我们如果发出一个搜索请求的话,会拿到一堆搜索结果,本节课,我们来讲解一下,这个搜索结果里的各种数据,都代表了什么含义 2、我们来讲解一下,搜索的timeout机制,底层的原理,画图讲解 GET /_search { "took": 6, "timed_out": false, "_sh 阅读全文
posted @ 2024-10-01 20:06 5765809 阅读(30) 评论(0) 推荐(0)
摘要:课程大纲 bulk api奇特的json格式 {"action": {"meta"}}\n {"data"}\n {"action": {"meta"}}\n {"data"}\n [{ "action": { }, "data": { } }] 1、bulk中的每个操作都可能要转发到不同的node 阅读全文
posted @ 2024-10-01 19:50 5765809 阅读(14) 评论(0) 推荐(0)
摘要:1、客户端发送请求到任意一个node,成为coordinate node 2、coordinate node对document进行路由,将请求转发到对应的node,此时会使用round-robin随机轮询算法,在primary shard以及其所有replica中随机选择一个,让读请求负载均衡 3、 阅读全文
posted @ 2024-10-01 19:48 5765809 阅读(11) 评论(0) 推荐(0)
摘要:(1)consistency,one(primary shard),all(all shard),quorum(default) 我们在发送任何一个增删改操作的时候,比如说put /index/type/id,都可以带上一个consistency参数,指明我们想要的写一致性是什么? put /ind 阅读全文
posted @ 2024-10-01 19:47 5765809 阅读(18) 评论(0) 推荐(0)
摘要:(1)客户端选择一个node发送请求过去,这个node就是coordinating node(协调节点) (2)coordinating node,对document进行路由,将请求转发给对应的node(有primary shard) (3)实际的node上的primary shard处理请求,然后 阅读全文
posted @ 2024-10-01 19:46 5765809 阅读(8) 评论(0) 推荐(0)
摘要:(1)document路由到shard上是什么意思? (2)路由算法:shard = hash(routing) % number_of_primary_shards 举个例子,一个index有3个primary shard,P0,P1,P2 每次增删改查一个document的时候,都会带过来一个r 阅读全文
posted @ 2024-10-01 19:44 5765809 阅读(25) 评论(0) 推荐(0)
摘要:1、阶段性总结 1~8讲:快速入门了一下,最基本的原理,最基本的操作 9~13讲:在入门之后,对ES的分布式的基本原理,进行了相对深入一些的剖析 14~27讲:围绕着document这个东西,进行操作,进行讲解和分析 2、什么是distributed document store 到目前为止,你觉得 阅读全文
posted @ 2024-10-01 19:43 5765809 阅读(22) 评论(0) 推荐(0)
摘要:课程大纲 1、bulk语法 POST /_bulk { "delete": { "_index": "test_index", "_type": "test_type", "_id": "3" }} { "create": { "_index": "test_index", "_type": "te 阅读全文
posted @ 2024-10-01 19:42 5765809 阅读(16) 评论(0) 推荐(0)