草庐IT

Elasticsearch-dump

全部标签

elasticsearch - 戈朗错误 "not enough arguments in call"

我刚接触golang。尝试通过golang实现批量上传到Elasticsearch。我正在使用golang库->https://github.com/olivere/elastic用于与Elasticsearch通信。此外,我正在尝试一段示例代码,但出现以下错误...suresh@BLR-245:~/Desktop/tools/golang/src$goinstallgithub.com/crazyheart/elastic-bulk-upload#github.com/crazyheart/elastic-bulk-uploadgithub.com/crazyheart/elasti

Elasticsearch CreateIndex() 参数不足

我正在尝试将ElasticsearchforGO与这个著名的repo结合使用但是,当我尝试创建一个index(docs,并作为示例给出here)时://Defineanelasticclientclient,err:=elastic.NewClient(elastic.SetURL("host1"))iferr!=nil{client,err:=elastic.NewClient(elastic.SetURL("host2"))iferr!=nil{fmt.Println("ErrorwhenconnectingElasticsearchhost");}}//Createanindex

csv - 戈朗 : convert text dump to CSV

我有一个txt文件转储,其中包含以下行格式的数据:2015/01/01-01:00:00,{'a50':15.5,'a95':14.5,'a99':21.5}我想提取值并将其转换为以下格式的CSV:2015/01/01,15.5,14.5,21.5到目前为止,我可以读取文件并提取数据,我还可以使用正则表达式获取时间戳值(但我知道Go中的正则表达式非常慢),我避免做更多的正则表达式来提取剩余的值。有什么指点吗? 最佳答案 如果时间允许,我可能会根据需要使用代码示例跟进此问题,但这里是我将如何处理该问题的基本纲要。1)创建一个类似下面的

elasticsearch - 如何在 elasticsearch 中只存储有限数量的文档。

我只需要在特定索引下存储10个数字文档。第11项应替换旧项,即第1项。这样我在任何时候都只有10个文档。我在golang中使用elacticsearch 最佳答案 如果您只想存储10个文档,那么您应该应用algo=(documentno%10)+1。返回值是您的elasticsearch_id字段算法仅返回1到10。并始终对其进行索引。 关于elasticsearch-如何在elasticsearch中只存储有限数量的文档。,我们在StackOverflow上找到一个类似的问题:

elasticsearch - 在 Golang 中使用 Elasticsearch scriptfield

我正在尝试使用脚本字段来计算DocumentResponse结构中的小计(小时数*价格)。没有脚本字段也能正常工作。都是基于这个例子https://outcrawl.com/go-elastic-search-service/如果这是一个非常简单的错误,我对编码完全陌生,请不要感到惊讶。我的猜测是在解码响应时出了点问题。这些是有问题的结构:typeDocumentResponsestruct{IDstring`json:"id"`CreatedAttime.Time`json:"created_at"`Projectstring`json:"project"`Hoursfloat64`

elasticsearch - 如何在 Golang 中使用 Olivere 将数据插入 Elasticsearch

我需要一个正确的示例,我可以在其中使用golang中的olivere将数据插入到elasticsearch中。我已经收集了数据,它会打印将要插入的每个数据的结果。问题是没有数据插入elasticsearch。这是用于收集将插入到elasticsearch中的数据的代码。indexing:=companyindextype:=employeedata:=lists{Id:id__,Article_id:id_row,Category_id:category_id,Datee:date,Media_id:media,Mention_times:mention,Data_input_date

es的配置文件(elasticsearch.yml)

config目录下有2个配置文件:es的配置文件(elasticsearch.yml)和日志配置文件(logging.yml)cluster.name:elasticsearch配置es的集群名称,默认是elasticsearch,es会自动发现在同一网段下的es,如果在同一网段下有多个集群,就可以用这个属性来区分不同的集群。node.name:“FranzKafka”节点名,默认随机指定一个name列表中名字,该列表在es的jar包中config文件夹里name.txt文件中,其中有很多作者添加的有趣名字。node.master:true指定该节点是否有资格被选举成为node,默认是true

Elasticsearch7.8.0版本入门—— 单字段排序文档(高级查询)

目录一、初始化文档数据二、单字段排序文档2.1、概述2.2、示例一、初始化文档数据在Postman中,向ES服务器发POST请求:http://localhost:9200/user/_doc/1,请求体内容为:{"name":"zhangsan","age":20,"sex":"男"}在Postman中,向ES服务器发POST请求:http://localhost:9200/user/_doc/2,请求体内容为:{"name":"zhangsan1","age":21,"sex":"男"}在Postman中,向ES服务器发POST请求:http://localhost:9200/user/_

.Net Core中使用NEST简单操作Elasticsearch

C#中访问Elasticsearch主要通过两个包NEST和Elasticsearch.Net,NEST用高级语法糖封装了Elasticsearch.Net可以通过类Linq的方式进行操作,而Elasticsearch.Net相比之下更为原始直接非常自由。注意:ES的8.X以上的版本有新的包Elastic.Clients.Elasticsearc支持。此处使用NEST,我们通过Nuget安装,如下图:1、准备结构准备以下实体publicclassCompany{publicstringId{get;set;}publicstringName{get;set;}publicstringDescr

elasticsearch - 没有在 Field ElasticSearch 6.4.3 上声明类型关键字的处理程序

请问这是什么原因。这是代码packagemainimport("context""errors""fmt""time""github.com/olivere/elastic")const(indexName="applications"docType="log"appName="myApp"indexMapping=`{"mappings":{"log":{"properties":{"app":{"type":"keyword"},"message":{"type":"keyowrd"},"time":{"type":"date"}}}}}`)typeLogstruct{Appstr