草庐IT

ELasticSearch

全部标签

windows - 在 Windows 上安装 PacketBeat

我无法找到在Windows上安装elastic的packetbeat的可靠方法。我知道我必须下载源代码并创建我自己的Windows程序包。但是,所有说明都已过时,并且是在它移至elastic域之前的。有人知道如何为windows编译这个包吗? 最佳答案 从此page下载并安装WinPcap.WinPcap是一个使用驱动程序来启用数据包捕获的库。从here下载PacketbeatWindowszip文件.将zip文件的内容解压缩到C:\ProgramFiles。将packetbeat--windows目录重命名为Packetbeat。

elasticsearch - 如何使用 Go 按时间范围过滤结果在 elasticsearch 中进行搜索

我对Go编程还很陌生。我正在尝试创建一个简单的程序,它只做一件事,通过elasticsearchAPI搜索字符串。我的问题特定于我正在使用的“gopkg.in/olivere/elastic.v2”包。这是一个代码示例:packagemainimport("fmt""gopkg.in/olivere/elastic.v2""log""reflect")typeSyslogstruct{ProgramstringMessagestringTimestampstring}funcmain(){client,err:=elastic.NewClient(elastic.SetURL("htt

json - 如何将 hit.Source 反序列化为 golang 中的结构

我一直在使用这个存储库:https://github.com/olivere/elastic下一段代码是golang中elasticsearch查询的例子:searchResult,err:=client.Search().Index("mx").Type("postal_code").Source(searchJson).Pretty(true).Do()iferr!=nil{panic(err)}ifsearchResult.Hits.TotalHits>0{for_,hit:=rangesearchResult.Hits.Hits{vardDocumenterr:=json.Un

elasticsearch - DeleteByQuery ElasticSearch Golang 错误 elastic : Error 404 (Not Found)

我正在尝试从我的索引中删除具有特定产品ID的文档。示例代码如下:packagemainimport("encoding/json""log""time""fmt""gopkg.in/mgo.v2/bson"elastic"gopkg.in/olivere/elastic.v3")funcmain(){client,err:=elastic.NewClient(elastic.SetSniff(false),elastic.SetURL("http://localhost:9200"))iferr!=nil{log.Fatal("CannotcreateESclient:",err)}b

elasticsearch - 并发文件解析并插入到 Elastic Search 中

我最近在玩Go,想出了一个小脚本来解析日志文件并将它们插入到Elasticsearch中。对于每个文件,我都生成了一个这样的goroutine:varwg:=sync.WaitGroup{}wg.Add(len(files))for_,file:=rangefiles{gofunc(fos.FileInfo){deferwg.Done()ProcessFile(f.Name(),config.OriginFilePath,config.WorkingFilePath,config.ArchiveFilePath,fmt.Sprintf("http://%v:%v",config.Ela

elasticsearch - 无法连接到我的代理 elasticsearch 节点

我在从我的Go客户端连接到我的es节点时遇到问题。我在设置基本身份验证的nginx代理后面有elasticsearch。除了内存,所有设置在ES中都是默认的。通过浏览器可以很好地工作,但不能通过这个客户端:https://github.com/olivere/elastic我阅读了文档,它说它使用/_nodes/httpapi进行连接。现在这可能是我做错的地方,因为来自该api的响应如下所示:{"_nodes":{"total":1,"successful":1,"failed":0},"cluster_name":"elasticsearch","nodes":{"u6TqFjAvR

elasticsearch - 在 google go 中使用 olivere/elastic 通过 ElasticSearch 中的查询更新记录

我在我的go应用程序中使用olivere/elastic库进行Elasticsearch。我有elasticsearch文档的特定字段(比如fieldA)的值列表。我想通过搜索字段fieldA来更新所有文档的特定字段。这个:UpdatingarecordinElasticSearchusingolivere/elasticingooglego解释更新部分。但就我而言,没有要更新的文档ID。所以,要么我可以进行搜索调用以检索文档ID,然后更新它们,要么还有另一种方法丢失了吗?提前致谢。 最佳答案 如果需要更新文件列表,可以使用Upda

Elasticsearch 查询 : Select documents by comparing lists of values (golang)

我有一种在ElasticSearch中索引的文档,其简化结构如下:{id:"54"properties:["nice","green","small","dry"]}现在我想选择该索引中的所有文档,这些文档不在properties字段中包含给定值的列表。类似于:SELECT*FROMindexWHEREpropertiesNOTCONTAINS["red","big","scary"]我如何在elasticsearch上实现它?(而且我有人知道如何在Golang上实现这样的查询,我会做得更好:-))谢谢! 最佳答案 您可以使用子句b

go - ElasticSearch 上特定搜索类型的分页

我们目前正在使用ElasticSearch6.7,并且有大量数据使一些请求花费了太多时间。为了避免这个问题,我们想在我们对elasticsearch的研究中设置分页。问题是我无法将ES提出的一种分页方法放在已经存在的不同请求上。例如,此请求包含不同的聚合和查询:https://github.com/trackit/trackit/blob/master/usageReports/lambda/es_request_constructor.go#L61-L75此外,在收集信息后对结果进行排序。我尝试设置SearchAfter方法以及使用from和size的分页形式。滚动不适用于聚合,复合

json - Elastigo 和 Go,使用带有变量的原始 json 字符串进行搜索

这个网站有一个elasticsearch查询的例子:https://github.com/mattbaird/elastigo例子是这样的:使用原始json字符串进行搜索searchJson:=`{"query":{"term":{"user":"kimchy"}}}`out,err:=core.SearchRequest(true,"twitter","tweet",searchJson,"")iflen(out.Hits.Hits)==1{fmt.Println(string(out.Hits.Hits[0].Source))}但是我需要这样的东西:原始json字符串中的变量ter