Elasticsearch 总结与测验
1. 搜索与算分
结构化搜索与⾮结构化搜索
○ Term 查询和基于全⽂本 Match 搜索的区别
○ 对于需要做精确匹配的字段,需要做聚合分析的字段,字段类型设置为 Keyword
Query Context v.s Filter Context
○ Filter Context 可以避免算分,并且利⽤缓存
○ Bool 查询中 Filter 和 Must Not 都属于 Filter Context
2. 搜索与算分
● 搜索的算分
○ TF-IDF / 字段 Boosting
● 单字符串多字段查询:multi-match
○ Best_Field / Most_Fields / Cross_Field
● 提⾼搜索的相关性
○ 多语⾔:设置⼦字段和不同的分词器提升搜索的效果
○ Search Template 分离代码逻辑和搜索 DSL
○ 多测试,监控及分析⽤户的搜索语句和搜索效果
3. 聚合 / 分⻚
● 聚合
○ Bucket / Metric / Pipeline
● 分⻚
○ From & Size / Search After / Scroll API
○ 要避免深度分⻚,对于数据导出等操作,可以使⽤ Scroll API
4. Elasticsearch 的分布式模型
● ⽂档的分布式存储
○ ⽂档通过 hash 算法, route 并存储到相应的分⽚
● 分⽚及其内部的⼯作机制
○ Segment / Transaction Log / Refresh / Merge
● 分布式查询和聚合分析的内部机制
○ Query Then Fetch;IDF 不是基于全局,⽽是基于分⽚计算,,因此,数据量少的时候,算分不准
○ 增加 “shard_size” 可以提⾼ Terms 聚合的精准度
5. 数据建模及重要性
● 数据建模
○ ES 如何处理管理关系 / 数据建模的常⻅步骤 / 建模的最佳实践
● 建模相关的⼯具
○ Index Template / Dynamic Template / Ingest Node / Update By Query / Reindex / Index Alias
● 最佳实践
○ 避免过多的字段 / 避免 wildcard 查询 / 在 Mapping 中设置合适的字段
阅读官方文档
6. 测试
DELETE test
PUT test/_doc/1
{
"content":"Hello World"
}
POST test/_search
{
"profile": "true",
"query": {
"match": {
"content": "Hello World"
}
}
}
POST test/_search
{
"profile": "true",
"query": {
"match": {
"content": "hello world"
}
}
}
POST test/_search
{
"profile": "true",
"query": {
"match": {
"content.keyword": "Hello World"
}
}
}
POST test/_search
{
"profile": "true",
"query": {
"match": {
"content.keyword": "hello world"
}
}
}
POST test/_search
{
"profile": "true",
"query": {
"term": {
"content": "Hello World"
}
}
}
POST test/_search
{
"profile": "true",
"query": {
"term": {
"content": "hello world"
}
}
}
POST test/_search
{
"profile": "true",
"query": {
"term": {
"content.keyword": "Hello World"
}
}
}
-
判断题:⽣产环境中,对索引使⽤ Index Alias 是⼀个好的实践 ,
答:对
,不用改变已有数据和索引 -
在 Terms 聚合分析中,有哪些⽅法可以提⾼查询的精准度
两种方法:
1.数据量不大的时候,分片数量设置为1,就不会存在聚合分析精准度的问题。
2.当数据量多大,不得不分片的时候,term -
如何通过聚合分析知道,每天⽹站中的访客来⾃多少不同的 IP
-
请描述 “multi_match” 查询中 “best_field”的⾏为
答: 最高分搜索 -
对搜索结果分⻚时,所采⽤的两个参数
from和size -
判断题:使⽤ Scroll API 导出数据时,即使中途有新的数据写⼊,这些数据也能被导出
答:错
,新写入的数据不能导出,因为是通过快照的方式
相关文章
- Elasticsearch-配置
- Elasticsearch Index模块
- Logstash中如何处理到ElasticSearch的数据映射
- ElasticSearch技术总结
- Elasticsearch Join类型查询父子关系
- Elasticsearch Bucket & Metric 聚合分析及嵌套聚合
- Elasticsearch 结构化搜索详解
- Elasticsearch 第一阶段总结与测试
- 《深入理解Elasticsearch(原书第2版)》一第1章Elasticsearch简介1.1 Apache Lucene简介
- elasticsearch——部分聚合结果不准确
- ElasticSearch Root身份运行
- ElasticSearch Aggregation
- elasticsearch的master选举
- 【ElasticSearch系列-01】初识以及安装elasticSearch
- Elasticsearch学习笔记(强推)
- ElasticSearch图解
- 搞定 ElasticSearch系列一 下载安装
- Linux使用 RPM 安装 Elasticsearch
- 《深入理解Elasticsearch(原书第2版)》——第2章 查询DSL进阶 2.1 Apache Lucene默认评分公式解释
- ElasticSearch搜索引擎常见面试题总结
- ElasticSearch使用
- elasticsearch中的几个概念总结
- Elasticsearch配置详解、文档元数据
- ElasticSearch报 EsThreadPoolExecutor[search, queue capacity = 1000, org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor@c0efba
- windows下载安装ElasticSearch