草庐IT

logstash-output-elasticsearch

全部标签

ruby - ElasticSearch 术语按整个字段聚合

如何编写考虑整个字段值而不是单个标记的ElasticSearch术语聚合查询?例如,我想按城市名称聚合,但以下返回new、york、san和francisco作为单独的桶,而不是纽约和旧金山作为预期的桶。curl-XPOST"http://localhost:9200/cities/_search"-d'{"size":0,"aggs":{"cities":{"terms":{"field":"city","min_doc_count":10}}}}' 最佳答案 您应该在映射中修复此问题。添加一个not_analyzed字段。如果您

ruby-on-rails - 无法通过 Homebrew 启动 elasticsearch 服务器

所以我通过brew安装了elasticsearch:$brewinstallelasticsearch然后当我运行elasticsearch服务器时:elasticsearch-f-Des.config=/usr/local/Cellar/elasticsearch/0.19.3/config/elasticsearch.yml我收到这个错误:{0.20.4}:SetupFailed...-FailedToResolveConfigException[Failedtoresolveconfigpath[/usr/local/Cellar/elasticsearch/0.19.3/con

ruby - 为什么在生产中使用 Net::HTTP 的 set_debug_output 是危险的?

Net::HTTP库中有一个非常有用的方法可以调试HTTP请求。这是文档对此的描述:set_debug_output(output)WARNINGThismethodcausesserioussecurityhole.Neverusethismethodinproductioncode.Setanoutputstreamfordebugging.http://ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html#M001371这里提到的安全漏洞是什么? 最佳答案

(二)ElasticSearch使用

一、ES的基本使用1.创建索引 创建一个test索引http://localhost:9200/test 2.删除索引http://localhost:9200/test3.查看索引http://localhost:9200/_all 4.向索引中新增数据http://localhost:9200/person/_doc/ 5.搜索数据http://localhost:9200/person/_doc/_search?q=first_name:wj但是我并没匹配到,后面发现必须写成之前新增的wj8, 二、Kibana使用http://localhost:5601/app/home#/ Kiba

Elasticsearch--02.Kibana8.1.0安装

1.下载安装概述:Kibana是一个针对Elasticsearch的开源分析及可视化平台,用来搜索、查看交互存储在Elasticsearch索引中的数据。使用Kibana,可以通过各种图表进行高级数据分析及展示。下载地址:Kibana8.1.0|Elastic解压到指定目录:tar-xzvfkibana-8.1.0-linux-x86_64.tar.gz-C/opt/module/2.Kibana生成证书文件在es服务器中生成证书、直接回车cd/opt/module/elasticsearch-8.1.0/bin/elasticsearch-certutilcsr-namekibana-dns

ruby-on-rails - NoMethodError(#<Elasticsearch::Model::Response::Result> 的未定义方法 `highlight'

我将为我的ruby​​onrails项目使用Elasticsearch。当我搜索一些在我的文章中使用过多的词时,出现此错误。NoMethodError(undefinedmethod`highlight'for#)我在日志制作中得到了这个。这就是我所做的一切:在Controller中:#POST/search/articledefsearchrenderjson:Article.search(params[:query]),each_serializer:ElasticsearchResultsSerializerend这是我的article.rb模型#default_scope{or

ruby-on-rails - searchkick 和 elasticsearch-rails 有什么区别?

这两个似乎都是非常活跃且相当流行的railsElasticsearchgem。似乎主要区别在于searchkick具有更多基于个人用户的自定义。在选择使用哪一种之前,人们需要考虑哪些差异?https://github.com/elasticsearch/elasticsearch-rails*s872fork165latestcommit2.5monthsagohttps://github.com/ankane/searchkick*s1,594fork165latestcommit11daysago 最佳答案 Searchkick

ruby 管道 : How do I tie the output of two subprocesses together?

在Ruby中是否有自动执行shell管道的方法?我正在尝试将以下shell代码转换为Ruby:a|b|c...>...但到目前为止我找到的唯一解决方案是自己进行缓冲区管理(经过简化,未经测试,希望它能理解我的意思):a=IO.popen('a')b=IO.popen('b','w+')Thread.new(a,b){|in,out|out.write(in.readpartial(4096))untilin.eof?out.close_write}#dealwithb.read...我想我正在寻找的是一种告诉popen使用现有流而不是创建新流的方法?或者,将a的输出连接到b的输入的IO

ruby-on-rails - Elasticsearch 和轮胎 : Using Mapping and to_indexed_json

在阅读Tire时文档,我的印象是您应该使用mapping或to_indexed_json方法,因为(我的理解是..)使用了mapping提供to_indexed_json。问题是,我发现一些教程同时使用了这两种方法。为什么?基本上,我的应用程序现在可以使用to_indexed_json但我无法弄清楚如何设置某些属性的提升值(因此我开始查看映射的原因)并且我想知道同时使用两者是否会造成一些冲突。 最佳答案 虽然mapping和to_indexed_json方法是相关的,但实际上它们有两个不同的目的。mapping方法的目的是为索引中的

Elasticsearch / Nest搜索具有同义词,复数和错误的搜索

我想进行实现以下项目的搜索。现在,我已经通过Regex实施了所有这些,这远非涵盖所有内容,我想知道我可以为此使用elasticsearch多少:同义词我的理解是,当创建索引时,这将实现。indexSettings.Analysis.TokenFilters.Add(“同义词”,新的同义词tokenfilter{synonyms=new[]{“tire=&gt;tire”,“aluminum=&gt;aluminum”},ignorecase=true,true,true,tokenizer=tokenizer=“whitespace”whitespace“whitespace”}));但是我还