Failed to create client for go-elasticsearch

I'm trying to create a client using go-elasticsearch with a viewer permission user who can only play a read role. The problem is that I'm getting a 403 error. Here is the corresponding error log

"type":"security_exception","reason":"action [cluster:monitor/main] is unauthorized for user [readonly] with effective roles [viewer], this action is granted by the cluster privileges [monitor,manage,all]"

This does not happen in JS-elasticsearch.
Is the action related to monitor included by default in Go-elasticsearch? How can I turn it off? I don't see it when I look at the interface of the Config type.

This is my current connection code block.

cfg := elasticsearch.Config{
		Addresses: []string{
			esConfig.Host,
		},
		Username:          esConfig.User,
		Password:          esConfig.Password,
	}

I don't want to just grant permissions, I want to start with just viewer permissions like JS-Elasticsearch works.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.