草庐IT

Elasticsearch-dump

全部标签

elasticsearch - 有没有办法通过 Elasticsearch 查询故意返回空值?

我必须在我的代码中返回一个elasticsearch查询(Golang使用olivere的elasticv.5库),如果出现特定情况,我希望能够传递一个耗时最短且始终返回null的查询。有没有标准的方法来做到这一点?我尝试使用带有空字符串作为参数的Term查询:elastic.NewTermQuery("","")但这似乎不是一个有效的查询。有什么好的方法吗? 最佳答案 如果“始终返回null”是指不匹配:{"bool":{"must_not":{"match_all":{}}}}我确信match_all的实现非常有效。

docker - 无法在 Raspberry Pi 上运行 elasticsearch 镜像

尝试在我的树莓派上运行elasticsearch图像时出现错误。它在我的Mac上运行良好,所以它可能是特定于操作系统的。我可以运行其他图像。pi@raspberrypi:~/folder/folder$dockerrunnode:latestpi@raspberrypi:~/folder/folder$dockerrundocker.elastic.co/elasticsearch/elasticsearch:5.6.3standard_init_linux.go:195:execuserprocesscaused"execformaterror"广泛搜索了standard_init_

elasticsearch - 将 Elasticsearch DSL 翻译成 gopkg.in/olivere/elastic.v5

我有json,我想使用https://godoc.org/gopkg.in/olivere/elastic.v5将其转换为Elasticsearch查询JSON={"query":{"bool":{"filter":[{"exists":{"field":"Videos.en"}}]}}}很简单!到目前为止我所得到的——这显然是行不通的——是:enVidsQuery,err:=elastic.NewBoolQuery().Filter(elastic.Exists("field","Videos.en"))elastic在我的导入中引用了“gopkg.in/olivere/elasti

elasticsearch - GoLang 从 Elasticsearch 结果中解码 JSON

我有从Elasticsearch返回的数据,使用“github.com/olivere/elastic”。那种工作,当我将它添加到我的结构并将其串起来时,就像这样,data:=Api{Total:myTotal,Data:string(result),}c.JSON(http.StatusOK,totalData)api是这样的结构,typeApistruct{Totalinterface{}Datainterface{}}这将返回数据正常,从1到请求的任意数量的结果。加载到数据接口(interface)的结果如何不转义什么的,例如"Data":"{\"CID\":\"XXXXXXXX

elasticsearch - 更新整个选定的弹性记录

使用olivere/elastic将我的Go(1.10)连接到在Docker容器中运行的Elastic搜索。现在,当数据库有更新时,它将对我的API运行一个触发器,它应该在我的Elastic搜索中搜索该记录,如果没有找到则添加一条新记录,或者如果找到则更新整个记录。现在我有了添加新记录的代码并且可以正常工作,但是我看不到如何更新整个记录,我可以更新该记录的选定元素,但不能更新整个记录。这是我的:testData:=[]byte(`{"data1":"22222","data2":"ddddd"}`)script:=elastic.NewScript("ctx._source=param

elasticsearch - 从 Elasticsearch 中同步删除文档

我正在使用olivere/elastic在Go中使用elasticsearch。这是我的代码://(1)deletedocument_,err:=e.client.Delete().Index(index).Type("entity").Id(id).Do(e.ctx)iferr!=nil{fmt.Println(err.Error())}//(2)getalldocumentsresult,err:=e.client.Search().Index(index).From(1).Size(100).Do(e.ctx)iferr!=nil{log.Println(err)}fmt.Pri

elasticsearch - {"error":"Content-Type header [] is not supported","status":406} When Inserting Data to Elasticsearch with Golang

有谁知道如何解决这个错误?我用Golang向elasticsearch中插入数据,但是好像因为这个错误没有插入数据。{"error":"Content-Typeheader[]isnotsupported","status":406}我已经设置了内容类型。注意我用的是elasticsearch6.4.3request,err:=http.NewRequest("POST",urlSearch,bytes.NewBuffer(query))request.Close=truerequest.Header.Set("Content-Type","application/json")最后但同

elasticsearch - 如何在 Elastigo 中设置 Content-Type header

我在尝试使用elastigo将数据插入elasticsearch时收到此错误。错误是{"error":"Content-Typeheader[]isnotsupported","status":406}有谁知道如何将内容类型header设置为elastigo?我认为Elastigo不适用于elasticsearch6.4.3,我是否应该更改为olivere包来向elasticsearch发出请求? 最佳答案 shouldIchangetooliverepackagetomakerequeststoelasticsearch?是的

elasticsearch - 如何检索 elasticsearch golang 客户端中搜索命中的整个来源?

我有一个包含太多字段的索引,比如一个文档有6个字段,另一个有不同数量的字段,总共有近千个不同的字段。我关注了这个https://github.com/olivere/elastic/wiki/Search,它工作正常,但我无法创建所有字段的结构并对其执行json.Unmarshal(*hit.Source,&t)。有什么方法可以在没有字段结构的情况下检索整个源。我使用elasticsearch版本-7和olivreelasticsearchgolang库。 最佳答案 如果我理解正确,您不想解码json结果-您只想访问该值。搜索操作返

服务搭建篇(七) Elasticsearch单节点部署以及多节点集群部署

感兴趣的话大家可以关注一下公众号:猿人刘先生,欢迎大家一起学习,一起进步,一起来交流吧!1.ElasticsearchElasticsearch(简称ES)是一个分布式,RESTful风格的搜索和数据分析引擎,使用java开发并且是当前最流行的开源的企业级搜索引擎,能够达到近实时搜索,稳定,可靠,快速,安装使用方便。客户端支持Java、.NET(C#)、PHP、Python、Ruby等多种语言。官方网站:https://www.elastic.co/下载地址:https://www.elastic.co/cn/downloads/past-releases#elasticsearch2.单节点