社区日报 第1292期 (2021-08-30)
社区日报 • cyberdak 发表了文章 • 0 个评论 • 1446 次浏览 • 2021-08-30 14:02
https://www.cnblogs.com/sanduz ... .html
2.Elasticsearch 慢查询设置
https://blog.csdn.net/wang7075 ... 93713
3.es分析过程
https://www.cnblogs.com/Neeo/a ... .html
编辑:cyberdak
归档:https://ela.st/cn-daily-all
订阅:https://ela.st/cn-daily-sub
沙龙:https://ela.st/cn-meetup
Elasticsearch:分页搜索结果
Elasticsearch • liuxg 发表了文章 • 0 个评论 • 1673 次浏览 • 2021-08-30 12:31
默认情况下,搜索会返回前 10 个匹配的匹配项。 要翻阅更大的结果集,你可以使用搜索 API 的 from 和 size 参数。 from 参数定义要跳过的命中数,默认为 0。 size 参数是要返回的最大命中数。 这两个参数共同定义了一页结果。比如:
GET /twitter/_search
{
"from": 5,
"size": 20,
"query": {
"match": {
"city": "北京"
}
}
}
避免使用 from 和 size 来分页太深或一次请求太多结果。 搜索请求通常跨越多个分片。 每个分片必须将其请求的命中和任何先前页面的命中加载到内存中。 对于深页面或大型结果集,这些操作会显着增加内存和 CPU 使用率,从而导致性能下降或节点故障。这里的原因是 index.max_result_window 的默认值是 10K,也就是说 from+size 的最大值是1万。搜索请求占用堆内存和时间与 from+size 成比例,这限制了内存。假如你想 hit 从 990 到 1000,那么每个 shard 至少需要 1000 个文档:
原文链接:https://elasticstack.blog.csdn ... 32811
关于Elasticsearch nested类型返回数据会比实际多的情况怎么解决?
Elasticsearch • lijianghu 回复了问题 • 2 人关注 • 1 个回复 • 1554 次浏览 • 2021-09-14 10:49
两个索引之间如何关联筛选?
Elasticsearch • kirito 回复了问题 • 3 人关注 • 2 个回复 • 1860 次浏览 • 2021-09-07 14:53
logstash aggregate filter 累加不正确
Logstash • tongchuan1992 回复了问题 • 2 人关注 • 1 个回复 • 1948 次浏览 • 2021-08-31 13:37
使用fdfs作为仓库做快照,如何优化速度?
Elasticsearch • tongchuan1992 回复了问题 • 2 人关注 • 1 个回复 • 1771 次浏览 • 2021-08-30 13:57
在银河麒麟的系统上部署Elastic Search
Elasticsearch • binzaijun 回复了问题 • 2 人关注 • 3 个回复 • 2594 次浏览 • 2021-08-31 13:37
社区日报 第1291期 (2021-08-28)
社区日报 • bsll 发表了文章 • 0 个评论 • 1350 次浏览 • 2021-08-28 21:12
[https://stackoverflow.com/ques ... ssors](https://stackoverflow.com/ques ... essors)
2.支持模块化构建语义搜索的开源工具
[https://github.com/deepset-ai/haystack](https://github.com/deepset-ai/haystack)
3.手把手教你构建一个搜索网站
[https://www.youtube.com/watch?v=uZfpKY5qtCI](https://www.youtube.com/watch?v=uZfpKY5qtCI)
* 编辑:bsll
* 归档:https://ela.st/cn-daily-all
* 订阅:https://ela.st/cn-daily-sub
* 沙龙:https://ela.st/cn-meetup
ik分词+拼音分词高亮范围扩大
Elasticsearch • yuechen323 回复了问题 • 2 人关注 • 1 个回复 • 1417 次浏览 • 2021-08-31 15:57
filebeat7.14 + docker启动后再次restart报错 filebeat: not found
回复Beats • lololo 发起了问题 • 1 人关注 • 0 个回复 • 4213 次浏览 • 2021-08-26 11:50
filebeat7.14解析非结构化日志如何处理不规则的空格?
Beats • lijianghu 回复了问题 • 2 人关注 • 1 个回复 • 3625 次浏览 • 2021-09-14 11:12
使用 Elasticsearch 时间点读取器获得随时间推移而保持一致的数据视图
Elasticsearch • liuxg 发表了文章 • 0 个评论 • 1456 次浏览 • 2021-08-26 10:05
大多数数据都不断变化。在 Elasticsearch 中查询索引,实际上是在一个给定的时间点搜索数据。由于索引不断变化(在大多数可观测性和安全性用例中皆如此),在不同的时间执行两个相同的查询将返回不同的结果,因为数据会随着时间而变化。那么,如果需要消除时间变量的影响,该怎么做呢?
Elasticsearch 7.10 中引入的时间点读取器可以让您反复查询某个索引,仿佛该索引处于某个特定的时间点。
从这个高度概括的介绍看,时间点功能似乎与滚动 API 类似,后者会检索下一批结果以完成滚动搜索。但两者间有一个微妙的差别,可以清楚表明为何时间点在未来将是“有状态”查询不可或缺的部分。
https://elasticstack.blog.csdn ... 25187
将ES索引从一个集群迁移到另一个集群的python脚本
Elasticsearch • 森 发表了文章 • 2 个评论 • 2293 次浏览 • 2021-08-25 17:20
将索引从一个集群(ip:192.168.0.1)迁移到另一个集群(ip:192.168.0.2),新集群需要配置白名单:
```ymlelasticsearch.yml
reindex.remote.whitelist: ['192.168.0.1:9200']
<br /> <br />python
import json
import requests
import base64
迁移索引数据
def reindex(index):
print("{0} 索引正在迁移中".format(index))
jsonData = {
"source": {
"remote": {
"host": "<a href="http://192.168.0.1:9200"" rel="nofollow" target="_blank">http://192.168.0.1:9200",
"socket_timeout": "30s",
"connect_timeout": "30s",
"username": "elastic",
"password": "123456"
},
"index": index
},
"dest": {
"index": index
}
}
res = requests.post("<a href="http://192.168.0.2:9200/_reindex"" rel="nofollow" target="_blank">http://192.168.0.2:9200/_reindex", json=jsonData)
print(res.status_code)
print(res.content)
获取创建索引的语句
def getIndexDslJson(index):
username = "elastic"
password = "123456"
user_info_str = username + ":" + password
user_info = base64.b64encode(user_info_str.encode()) # 这个得到是个字节类型的数据
headers = {
"Authorization": "Basic {0}".format(user_info.decode()) # 这个就是需要验证的信息
}
res = requests.get("http://192.168.0.1:9200/{0}".format(index),
headers=headers)
print(res.status_code)
jsonIndex = json.loads(res.content)
print(jsonIndex[index])
del jsonIndex[index]['settings']['index']['creation_date']
del jsonIndex[index]['settings']['index']['provided_name']
del jsonIndex[index]['settings']['index']['uuid']
del jsonIndex[index]['settings']['index']['version']
jsonIndex[index]['settings']['index']['number_of_shards'] = 1
jsonIndex[index]['settings']['index']['number_of_replicas'] = 0
return jsonIndex[index]
创建索引
def createIndex(index, dslJson):
res = requests.put("http://192.168.0.2:9200/{0}".format(index), json=dslJson)
print(res.status_code)
print(res.content)
if name == 'main':需要创建的索引
indexList = [
"index1_v1", "index2_v1"
]
for index in indexList:
dslJson = getIndexDslJson(index) # 获取原索引的结构
createIndex(index, dslJson) # 根据原索引结构,在新集群创建索引
reindex(index) # 将原集群索引迁移到新集群
```
使用docker安装es环境
Elasticsearch • 森 发表了文章 • 0 个评论 • 3839 次浏览 • 2021-08-25 16:31
创建es账号并授权
```
创建账号
adduser es
修改密码
passwd es
授权
chmod -v u+w /etc/sudoers
vim /etc/sudoers
新增
es ALL=(ALL) ALL
wq保存退出,这时候要记得将写权限收回
chmod -v u-w /etc/sudoers
```
创建docker网络
<br /> docker network create tx<br />
安装Elasticsearch
<br /> docker pull elasticsearch:6.7.1<br />
<br /> 在/home/es 中创建 config,data,plugins目录<br /> 在plugins目录中下载es相关插件,如:ik,pinyin等<br /> 在config中创建elasticsearch.yml配置,创建analysis\synonym.txt 同义词<br /> 给data配置权限 sudo chmod 777 /home/es/data/<br /> 将/home/es 目录及其子目录的用户改为es:chown -R es:root /home/es/<br />
```yml
elasticsearch.yml
cluster.name: "my-docker-cluster"
node.name: "es-node1"
network.host: 0.0.0.0
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: "Authorization,X-Requested-With,Content-Length,Content-Type"
node.master: true
reindex.remote.whitelist: ['other:9200']
xpack.security.enabled: true
xpack.security.authc.api_key.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: elastic-certificates.p12
<br /> <br /> <br /> <br />
docker run -d --net tx --name my_elasticsearch -p 9201:9200 -p 9301:9300 -v /home/es/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /home/es/config/analysis:/usr/share/elasticsearch/config/analysis -v /home/es/config/elastic-certificates.p12:/usr/share/elasticsearch/config/elastic-certificates.p12 -v /home/es/data:/usr/share/elasticsearch/data -v /home/es/plugins:/usr/share/elasticsearch/plugins -e "discovery.type=single-node" -i -t --privileged=true elasticsearch:6.7.1
```
安装kibana
<br /> docker pull kibana:6.7.1<br />
```yml
kibana.yml配置文件
server.name: kibana
server.host: 0.0.0.0
elasticsearch.hosts: ["<a href="http://my_elasticsearch:9200"" rel="nofollow" target="_blank">http://my_elasticsearch:9200"]
i18n.locale: "zh-CN"
elasticsearch.username: "elastic"
elasticsearch.password: "123456"
xpack.graph.enabled : true
xpack.ml.enabled : true
xpack.monitoring.enabled : true
xpack.reporting.enabled : true
xpack.security.enabled : true
xpack.watcher.enabled : true
<br /> <br />
docker run -d --name kibana --net tx -p 5601:5601 -v /home/kibana/kibana.yml:/usr/share/kibana/config/kibana.yml kibana:6.7.1
```
Kibana 中用公式和时间旅行回答的 10 个常见问题
Kibana • liuxg 发表了文章 • 0 个评论 • 2058 次浏览 • 2021-08-25 13:12
此外,在时间和空间中移动和重放数据是获取历史背景和了解关于现在的更多见解的有效方法。
在以下部分中,你将找到 10 个问题示例,你可以通过公式、时移和及时浏览数据,使用 Kibana 中的仪表板数据和地图可视化来回答这些问题。 尝试跟随你自己的数据或使用 Kibana 的示例数据集。 有问题吗? 前往我们的讨论论坛。
在名单上:
错误的比例在增加吗?
表现与上周相比如何?
这些数据与同行相比如何?
对我的平均水平影响最大的是什么?
与历史相比,原始收益/损失是多少?
收益/损失占过去业绩的百分比是多少?
数据是如何到达现在的位置的?
如何以交互方式探索空间中的仪表板?
这个指标的单位版本是什么?
我对上一时期的行业特定计算(例如“净推荐值”)是什么?
https://elasticstack.blog.csdn ... 83729

