草庐IT

elasticsearch-rest-high-level-cli

全部标签

api - 从 Golang REST API 生成 Amazon S3 token

我正在编写一个GolangRESTAPI,它需要为用户生成S3token,以便他们可以将文件上传到存储桶内的特定文件夹。这是我需要实现的:Method:GETEndpoint:myapp.com/images/:imageid/tokenDescription:Return2tokenssothattheusercanuploadfilestotheS3bucketrelatedtotheimageIDparameter.我正在使用Golangecho框架。而且我不太确定如何实现此功能。这应该通过AWSSDK完成,还是亚马逊提供其他以编程方式生成token的方式?

rest - 在使用 Auth0 的 golang 服务器中找出当前用户名

我正在使用auth0和golang作为休息服务,其实现与here类似。.我想知道如何找出当前触发某个API调用的用户的名称-例如,如果有人请求http://localhost:3000/products-中的go处理程序这个案例看起来像这样:varProductsHandler=http.HandlerFunc(func(whttp.ResponseWriter,r*http.Request){payload,_:=json.Marshal(products)w.Header().Set("Content-Type","application/json")w.Write([]byte(

go - 多个查询的正确方法 Go Rest API

我正尝试在Go中创建一个RESTAPI。我让它部分工作,因为它将返回4个单独的json对象,如下所示:[{"Name":"QA1","Server":"BOT1","Description":"Tools","Apps":""},{"Name":"QA1","Server":"","Description":"","Apps":"Duo"},{"Name":"QA1","Server":"","Description":"","Apps":"Git"},{"Name":"QA1","Server":"","Description":"","Apps":"php"}]我想要的是单个返回对

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

rest - 使用 http 包实现 REST 多资源和标识符

我的应用程序中有产品和项目。产品是项目的集合。例如,T恤是一种产品,它具有尺码和颜色等属性。尺码为S、M、L、XL,颜色为红色、绿色和蓝色。我想使用仅http包构建REST服务。(没有gorillaMux、Goji等)。POSTApi添加产品http://localhost/product对于以上,我使用http.HandleFunc("/product",AddProduct)funcAddProduct(whttp.ResponseWriter,r*http.Request){ifr.Method=="POST"{//Mycode}}我想知道如何实现以下内容:获取特定产品的项目列表

rest - 去 SSL 监听器

我正在用Go构建一个休息API。我有一个SSL域和一个专用服务器。域指向我的专用域并且工作正常(https://www.myweb.com)。错误是当我向我的API的某些端点发出请求时,我从未从服务器获得响应。funcmain(){router:=NewRouter()handler:=cors.New(cors.Options{AllowedMethods:[]string{"GET","POST","PUT","DELETE","PATCH"},AllowCredentials:true,AllowedOrigins:[]string{"*"},AllowedHeaders:[]s

rest - 在 Golang 中向 Splunk REST API/search/jobs/endpoint 发送查询

我想向SplunkRESTAPI发送搜索/查询,并返回搜索ID以供稍后使用结果。我可以通过以下curl实现所需的行为:#!/bin/bashuser='my_user'pass='my_pass'search='searchindex=shortsourcetype=src|head5'curl-u$user:$pass-khttps://111.22.33.44:8089/services/search/jobs-dsearch="$search"返回:234523452435.6556_234234-3J3J-34J4-2345-123456678E3以下是我试图在其中实现相同目标

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

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