草庐IT

elasticsearch-query

全部标签

ElasticSearch 爬坑记录

1.receivedplaintexthttptrafficonanhttpschannel,closingconnectionNetty4HttpChannel[2022-02-16T21:08:50,085][WARN][o.e.x.s.t.n.SecurityNetty4HttpServerTransport][DESKTOP-VCT39JM]receivedplaintexthttptrafficonanhttpschannel,closingconnectionNetty4HttpChannel{localAddress=/[0:0:0:0:0:0:0:1]:9200,remoteA

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

http - 去 Gin 框架 : Testing query and POST with cURL

我正在尝试theREADMEofginframework中的代码示例(“另一个例子:查询+发布表单”):packagemainimport("fmt""github.com/gin-gonic/gin")funcmain(){router:=gin.Default()router.POST("/post",func(c*gin.Context){id:=c.Query("id")page:=c.DefaultQuery("page","0")name:=c.PostForm("name")message:=c.PostForm("message")fmt.Printf("id:%s;p

google-app-engine - 应用引擎 : Geospatial queries under Go

在Java(https://cloud.google.com/appengine/docs/java/datastore/geosearch)下似乎有地理空间查询支持,但在Go下似乎完全没有做同样事情的文档。在google.golang.org/appengine中搜索“geo”只会呈现GeoPoint值的构造和验证。由于Java支持此功能,因此显然必须提供API支持。有没有人对此有任何经验或建议?谢谢。编辑:似乎只为Java提供了有限的支持:http://startup-with-gae.blogspot.com/2016/01/geospatial-queries-with-goo

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

sqlite - 运行时错误 : invalid memory address or nil pointer dereference when Querying

我一直在研究用于身份验证的API,在尝试将其部署到服务器时,我偶然发现了这个奇怪的错误。该代码在我的笔记本电脑上运行得非常好,但是当我尝试部署它时,出现了这个错误:PANIC:runtimeerror:invalidmemoryaddressornilpointerdereferencegoroutine21[running]:github.com/urfave/negroni.(*Recovery).ServeHTTP.func1(0x7f5771b811e8,0xc4200980e8,0xc42009a870,0xc420138800)/home/linux/go/src/gith

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