标签: elastic-stack

对具有某些日期范围的索引进行弹性搜索查询

我有以下场景:

我在弹性搜索中有以下索引。

  • 索引-2016.04.10
  • 索引-2016.04.11
  • 索引-2016.04.12
  • 索引-2016.04.15
  • 索引-2016.04.16
  • 索引-2016.04.18

现在假设,我想在日期之间的弹性搜索中搜索一些数据 - 2016.04.11 到 2016.04.16。我的问题是:

  1. 我们有没有办法运行单个查询并定义一些过滤器参数,以便仅在这两个日期之间的索引中进行搜索?

  2. 如果不是,那么我们如何优化搜索查询 如果我们需要在某个索引范围内搜索数据?

  3. Java 实现。

请帮忙..

elasticsearch elastic-stack

6
推荐指数
1
解决办法
3831
查看次数

如果我可以通过 REST 将数据发送到 elasticsearch,为什么要安装 logstash?

我安装了 elasticsearch 和 kibana,我正在学习教程。 https://www.elastic.co/guide/en/elasticsearch/reference/current/_index_and_query_a_document.html 而且我完美地插入和读取数据,例如:

PUT /customer/external/1?pretty
{
  "name": "John Doe"
}
Run Code Online (Sandbox Code Playgroud)

所以,这让我想知道,我需要 logstash 或 filebeats 做什么?我的计划是将网站上的每个 Web 请求记录到 elasticsearch 以进行分析。

我需要安装logstash吗?我不明白我需要它做什么。(我不打算将它存储在文件中)我将从 PHP 脚本中读取请求信息(例如 ip 地址、时间、user_id 等),然后简单地通过 HTTP REST REQUEST 发送它......如上面的例子到弹性搜索服务器,无论如何都会保存数据。所以,我看不出有任何理由将数据存储在网络服务器上(即数据重复性),如果我愿意,我为什么还需要 logstash ......我可以读取一个 .log 文件并将其发送到elasticsearch ....像这个例子:https : //www.elastic.co/guide/en/elasticsearch/reference/current/_exploring_your_data.html

lucene elasticsearch logstash elastic-stack filebeat

6
推荐指数
1
解决办法
2794
查看次数

"Message":"您的请求:'/_cluster/allocation/reroute' 不被允许。"}

我正在 AWS 集群上重新分配节点 1 的 AWS ES 集群中的副本分片。我希望主分片和副本分片都驻留在那里。但是当运行以下命令时出现错误

curl  -XPOST 'http://AWS-CLuster-name.com/_cluster/allocation/reroute' -d '{ "commands": [{"allocate_replica":{"index": ".kibana", "shard": 0, node: "nodename" "primary": false }'
Run Code Online (Sandbox Code Playgroud)

运行上述命令时,出现以下错误。

{"Message":"Your request: '/_cluster/allocation/reroute' is not allowed."}
Run Code Online (Sandbox Code Playgroud)

这是否意味着 AWS 中不允许手动分配分片?任何人都可以请澄清。

谢谢

amazon-web-services elasticsearch elastic-stack

6
推荐指数
2
解决办法
3989
查看次数

将kibana连接到kubernetes集群中的elasticsearch

我有一个正在运行的 elasticsearch 集群,我正在尝试将 kibana 连接到这个集群(同一节点)。目前,当我尝试使用 : 在浏览器中打开服务时,页面挂起。. 在我的 kibana pod 日志中,pod 中的最后几条日志消息是:

{"type":"log","@timestamp":"2017-10-13T17:23:46Z","tags":["listening","info"],"pid":1,"message":"Server running at http://0.0.0.0:5601"}
{"type":"log","@timestamp":"2017-10-13T17:23:46Z","tags":["status","ui settings","error"],"pid":1,"state":"red","message":"Status changed from uninitialized to red - Elasticsearch plugin is red","prevState":"uninitialized","prevMsg":"uninitialized"}
{"type":"log","@timestamp":"2017-10-13T17:23:49Z","tags":["status","plugin:ml@5.6.3","error"],"pid":1,"state":"red","message":"Status changed from yellow to red - Request Timeout after 3000ms","prevState":"yellow","prevMsg":"Waiting for Elasticsearch"}
Run Code Online (Sandbox Code Playgroud)

我挂载到 kibana pod 中的 kibana.yml 文件具有以下配置:

server.name: kibana-logging
server.host: 0.0.0.0 
elasticsearch.url: http://elasticsearch:9300
xpack.security.enabled: false
xpack.monitoring.ui.container.elasticsearch.enabled: true 
Run Code Online (Sandbox Code Playgroud)

并且我的 elasticsearch.yml 文件具有以下配置设置(我有 3 个 es pod)

cluster.name: elasticsearch-logs
node.name: ${HOSTNAME}
network.host: 0.0.0.0

bootstrap.memory_lock: false
xpack.security.enabled: false
discovery.zen.minimum_master_nodes: 2
discovery.zen.ping.unicast.hosts: ["172.17.0.3:9300", "172.17.0.4:9300", "172.17.0.4:9300"] …
Run Code Online (Sandbox Code Playgroud)

elasticsearch kibana kubernetes elastic-stack

6
推荐指数
1
解决办法
2207
查看次数

elasticsearch es_rejected_execution_exception

我正在尝试索引一个有 50,000 条日志的 12mb 日志文件。索引大约 30,000 条日志后,出现以下错误

[2018-04-17T05:52:48,254][INFO ][logstash.outputs.elasticsearch] retrying failed action with response code: 429 ({"type"=>"es_rejected_execution_exception", "reason"=>"rejected execution of org.elasticsearch.transport.TransportService$7@560f63a9 on EsThreadPoolExecutor[name = EC2AMAZ-1763048/bulk, queue capacity = 200, org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor@7d6ae98b[Running, pool size = 2, active threads = 2, queued tasks = 200, completed tasks = 3834]]"})
Run Code Online (Sandbox Code Playgroud)

但是,我浏览了文档和 elasticsearch 论坛,它们建议我增加 elasticsearch 批量队列的大小。我尝试使用 curl 但我无法做到这一点。

curl -XPUT localhost:9200/_cluster/settings -d '{"persistent" : {"threadpool.bulk.queue_size" : 100}}'
Run Code Online (Sandbox Code Playgroud)

增加队列大小是个好选择吗?我无法增加硬件,因为我的数据较少。

我面临的错误是由于队列大小问题还是其他原因?如果使用队列大小如何更新elasticsearch.yml中的队列大小,在el​​asticsearch.yml中更新后是否需要重新启动es?

请告诉我。谢谢你的时间

elasticsearch logstash elastic-stack

6
推荐指数
1
解决办法
1万
查看次数

Elasticsearch 随机返回一个查询的空结果,该查询在索引中有条目

我们使用 Elastic 6.0 和 Nest,有 1 个主副本和 3 个副本。有时,当我们运行查询时,它会返回空结果,而当我们立即再次运行它时,它会返回适当的结果。这是随机发生的,我看不到任何模式。我不知道是什么原因造成的,我可以提供更多信息。

谢谢

elasticsearch elastic-stack

6
推荐指数
0
解决办法
245
查看次数

仅返回匹配字段而不是返回整个文档

仅返回匹配的源,而不返回包含该文本的弹性搜索的整个文档

假设我有一个这种格式的数据,

POST /bookdb_index/book/_bulk
{ "index": { "_id": 1 }}
{ "title": "Elasticsearch: The Definitive Guide", "authors": ["clinton gormley", "zachary tong"], "summary" : "A distibuted real-time search and analytics engine", "publish_date" : "2015-02-07", "num_reviews": 20, "publisher": "oreilly" }
{ "index": { "_id": 2 }}
{ "title": "Taming Text: How to Find, Organize, and Manipulate It", "authors": ["grant ingersoll", "thomas morton", "drew farris"], "summary" : "organize text using approaches such as full-text search, proper name recognition, clustering, tagging, information extraction, and …
Run Code Online (Sandbox Code Playgroud)

elasticsearch kibana amazon-elastic-beanstalk elastic-stack elasticsearch-aggregation

6
推荐指数
1
解决办法
2498
查看次数

继续让套接字在 ElasticSearch 上挂出

我是 ElasticSearch 的新手。我正在为 ElasticSearch 集群中的一些索引重新建立索引。当我尝试重新索引具有大量数据的索引时,我收到套接字挂起错误。

const elasticsearch = require('elasticsearch');
const tempclient = new elasticsearch.Client({
  host: clusterhost,
  log: [{
    type: 'stdio',
    levels: ['error'],
  }],
  maxRetries: 50,
  requestTimeout: 1000 * 60 * 120,
  keepAliveFreeSocketTimeout: 1000 * 60 * 120,
});
await tempclient.reindex({
   body: {
      source: {
         index: indexes[i].index,
       },
      dest: {
         index: `logs-${yearMonth[0]}`,
      },
      script: {
         source: "ctx._type = 'doc';",
      },
  },
  timeout: '120m',
});
Run Code Online (Sandbox Code Playgroud)

node.js elasticsearch node-modules elastic-stack elasticsearch-5

6
推荐指数
0
解决办法
3130
查看次数

Elastic Search 地理空间搜索实现

我试图了解弹性搜索如何在内部支持地理空间搜索。

对于基本搜索,它使用倒排索引;但它如何与附加搜索条件(例如搜索特定半径内的特定文本)结合起来。

我想了解如何存储和查询索引以支持这些查询的内部结构

geospatial inverted-index elasticsearch elastic-stack

6
推荐指数
1
解决办法
726
查看次数

Zipkin 和 Elastic Stack(ELK) 之间的区别?

Spring Cloud Sleuth 用于创建traceId(跨服务请求时唯一)和spanId(对于一个工作单元来说是相同的)。我的想法是使用 Zipkin 服务器来跨服务获取这些日志的集体可视化。但我知道并且已经使用过 ELK 堆栈,它必然具有相同的功能。我的意思是我们可以使用 ELK 堆栈将具有相同 traceId 的请求分组以进行可视化。但我确实看到人们尝试使用 Sleuth、ELK 以及 Zipkin 来实现分布式跟踪,如这些示例(Link1Link2)中所示。但是如果已经有 ELK 来进行日志收集和可视化,为什么我们还需要 Zipkin呢?我哪里失踪了?

zipkin microservices elastic-stack spring-cloud-sleuth distributed-tracing

6
推荐指数
1
解决办法
5317
查看次数