join 类型如何查询子文档
aa1356889 回复了问题 • 3 人关注 • 2 个回复 • 3170 次浏览 • 2019-02-28 15:44
如何能得到两个query的匹配得分 es_match_score(query1, query2)?
回复deniel 发起了问题 • 1 人关注 • 0 个回复 • 3973 次浏览 • 2018-03-15 19:24
Elasticsearch6.x 以上版本,如何设置副本数量?
laoyang360 回复了问题 • 3 人关注 • 2 个回复 • 9478 次浏览 • 2018-03-15 23:27
query_string查询多值字段问题请教
hello3521 回复了问题 • 7 人关注 • 6 个回复 • 8330 次浏览 • 2018-11-14 17:44
ingest node中的pipeline如何处理文档字段缺失或为null的情形?
xinfanwang 回复了问题 • 3 人关注 • 1 个回复 • 2680 次浏览 • 2018-03-19 14:03
_id is not configurable
laoyang360 回复了问题 • 3 人关注 • 2 个回复 • 3432 次浏览 • 2018-03-15 08:19
java api 如何删除指定Index的别名
ygm 回复了问题 • 2 人关注 • 2 个回复 • 3393 次浏览 • 2018-03-15 16:54
elasticsearch分词检索的match-query匹配过程分析
夏李俊 发表了文章 • 4 个评论 • 5129 次浏览 • 2018-03-14 12:00
localhost:9200/yigo-redist.1/_analyze?analyzer=default&text=全能片(前)---TRW-GDB7891AT刹车片自带报警线,无单独报警线号码,卡仕欧,卡仕欧,乘用车,刹车片
上面的url表示- 索引为`yigo-redist.1`
- 使用了索引`yigo-redist.1`中的分词器(`analyzer`) `default`
- 解析的字符串(`text`)为"全能片(前)---TRW-GDB7891AT刹车片自带报警线,无单独报警线号码,卡仕欧,卡仕欧,乘用车,刹车片"
如果结果为:
{
"tokens" : [ {
"token" : "全能",
"start_offset" : 0,
"end_offset" : 2,
"type" : "CN_WORD",
"position" : 1
}, {
"token" : "片",
"start_offset" : 2,
"end_offset" : 3,
"type" : "CN_CHAR",
"position" : 2
}, {
"token" : "前",
"start_offset" : 4,
"end_offset" : 5,
"type" : "CN_CHAR",
"position" : 3
}, {
"token" : "trw-gdb7891at",
"start_offset" : 9,
"end_offset" : 22,
"type" : "LETTER",
"position" : 4
}, {
"token" : "刹车片",
"start_offset" : 22,
"end_offset" : 25,
"type" : "CN_WORD",
"position" : 5
}, {
"token" : "自带",
"start_offset" : 25,
"end_offset" : 27,
"type" : "CN_WORD",
"position" : 6
}, {
"token" : "报警",
"start_offset" : 27,
"end_offset" : 29,
"type" : "CN_WORD",
"position" : 7
}, {
"token" : "线",
"start_offset" : 29,
"end_offset" : 30,
"type" : "CN_CHAR",
"position" : 8
}, {
"token" : "无",
"start_offset" : 31,
"end_offset" : 32,
"type" : "CN_WORD",
"position" : 9
}, {
"token" : "单独",
"start_offset" : 32,
"end_offset" : 34,
"type" : "CN_WORD",
"position" : 10
}, {
"token" : "报警",
"start_offset" : 34,
"end_offset" : 36,
"type" : "CN_WORD",
"position" : 11
}, {
"token" : "线",
"start_offset" : 36,
"end_offset" : 37,
"type" : "CN_CHAR",
"position" : 12
}, {
"token" : "号码",
"start_offset" : 37,
"end_offset" : 39,
"type" : "CN_WORD",
"position" : 13
}, {
"token" : "卡",
"start_offset" : 40,
"end_offset" : 41,
"type" : "CN_CHAR",
"position" : 14
}, {
"token" : "仕",
"start_offset" : 41,
"end_offset" : 42,
"type" : "CN_WORD",
"position" : 15
}, {
"token" : "欧",
"start_offset" : 42,
"end_offset" : 43,
"type" : "CN_WORD",
"position" : 16
}, {
"token" : "卡",
"start_offset" : 44,
"end_offset" : 45,
"type" : "CN_CHAR",
"position" : 17
}, {
"token" : "仕",
"start_offset" : 45,
"end_offset" : 46,
"type" : "CN_WORD",
"position" : 18
}, {
"token" : "欧",
"start_offset" : 46,
"end_offset" : 47,
"type" : "CN_WORD",
"position" : 19
}, {
"token" : "乘用车",
"start_offset" : 48,
"end_offset" : 51,
"type" : "CN_WORD",
"position" : 20
}, {
"token" : "刹车片",
"start_offset" : 52,
"end_offset" : 55,
"type" : "CN_WORD",
"position" : 21
} ]
}
2. 关键词查询
localhost:9200//yigo-redist.1/_analyze?analyzer=default_search&text=gdb7891
- 索引为`yigo-redist.1`
- 使用了索引`yigo-redist.1`中的分词器(`analyzer`) `default_search`
- 解析的字符串(`text`)为"gdb7891"
返回结果:
{
"tokens" : [ {
"token" : "gdb7891",
"start_offset" : 0,
"end_offset" : 7,
"type" : "LETTER",
"position" : 1
} ]
}
3. 关键词使用存储的分词器查询
localhost:9200//yigo-redist.1/_analyze?analyzer=default&text=gdb7891
- 索引为`yigo-redist.1`
- 使用了索引`yigo-redist.1`中的分词器(`analyzer`) `default_search`
- 解析的字符串(`text`)为"gdb7891"
返回结果:
{
"tokens" : [ {
"token" : "gdb7891",
"start_offset" : 0,
"end_offset" : 7,
"type" : "LETTER",
"position" : 1
}, {
"token" : "",
"start_offset" : 0,
"end_offset" : 7,
"type" : "LETTER",
"position" : 1
}, {
"token" : "gdb7891",
"start_offset" : 0,
"end_offset" : 7,
"type" : "LETTER",
"position" : 1
}, {
"token" : "",
"start_offset" : 0,
"end_offset" : 3,
"type" : "ENGLISH",
"position" : 2
}, {
"token" : "gdb",
"start_offset" : 0,
"end_offset" : 3,
"type" : "ENGLISH",
"position" : 2
}, {
"token" : "gdb",
"start_offset" : 0,
"end_offset" : 3,
"type" : "ENGLISH",
"position" : 2
}, {
"token" : "7891",
"start_offset" : 3,
"end_offset" : 7,
"type" : "ARABIC",
"position" : 3
}, {
"token" : "7891",
"start_offset" : 3,
"end_offset" : 7,
"type" : "ARABIC",
"position" : 3
}, {
"token" : "",
"start_offset" : 3,
"end_offset" : 7,
"type" : "ARABIC",
"position" : 3
} ]
}
总结
- 通过步骤1可以看出,存储的数据"全能片(前)---TRW-GDB7891AT刹车片自带报警线,无单独报警线号码,卡仕欧,卡仕欧,乘用车,刹车片",被拆分成了很多词组碎片,然后存储在了索引数据中
- 通过步骤2可以看出,当关键词输入"gdb7891",这个在检索分词器(`default_search`)下,没有拆分,只一个可供查询的碎片就是"gdb7891",但是步骤1,拆分的碎片里不存在"gb7891"的词组碎片,唯一相近的就是"trw-gdb7891at",所以使用普通的match-query是无法匹配步骤1输入的索引数据
- 通过步骤3,可以看出如果使用相同的分词器,"gdb7891"能够拆分成"gdb","7891"等等,通过这2个碎片都能找到步骤1输入的索引数据,但是因为关键词被拆分了,所以会查询到更多的匹配的数据,比如:与"gdb"匹配的,与"7891"匹配的,与"gdb7891"匹配的
- 如果说想通过分词器(`default_search`)检索出步骤1的数据,需要使用wildcard-query,使用"*gdb7891*",就可以匹配
{ "query": { "wildcard" : { "description" : "*gdb7891*" } } }
ElasticSearch6.1.2数据插入问题
zjn_job 回复了问题 • 4 人关注 • 3 个回复 • 5883 次浏览 • 2018-07-04 16:58
elasticsearch参考手册 (译文)
code4j 发表了文章 • 2 个评论 • 6687 次浏览 • 2018-03-14 00:29
然后最近也是在debug 看源码,顺便想把官方文档也刷了,决定开始自己翻译 elasticsearch 官方参考手册。看到之前网上有人在翻译但是没有翻译完,自己也尝试一下。
公司用的是2.2版本的所以我就从这个版本开始翻译了,译文中会有一些批注,后续会持续关注高版本并把特性以批注的方式补上说明。
在线阅读: www.code4j.tech
github地址:https://github.com/rpgmakervx/ ... ation
掘金翻译计划:https://github.com/xitu/gold-miner
计划每周翻译两三篇吧,看情况。
英语只有六级啦,有些地方翻译起来也很笨拙,有翻译不恰当之处大家可以提issue呀!
elasticsearch 如何调整_score
chennanfei 回复了问题 • 4 人关注 • 2 个回复 • 2942 次浏览 • 2018-03-14 09:30
为什么会出现单个node的indexing指标会比集群所有索引indexing指标的和还大的情况
回复Loading Zhang 发起了问题 • 1 人关注 • 0 个回复 • 2582 次浏览 • 2018-03-13 18:01
elasticsearch5.0.0连接服务器NoNodeAvailableException
AlixMu 回复了问题 • 6 人关注 • 5 个回复 • 3938 次浏览 • 2018-05-16 23:23
执行GET _cat/indices?v结果的标题中文含义值什么
laoyang360 回复了问题 • 3 人关注 • 2 个回复 • 17864 次浏览 • 2018-03-13 20:57