Go-elasticsearch index operation


(Daniel) #1

Hello there,

I am trying to use the go-elasticsearch library in order to index documents from my application.
I have been trying the Index operation but it seems not to work (probably I am missusing it).
I went to look at the code of the library and apparently it seems like it is not using neither the index nor the document provided to the function:

func (a *API) Index(index string, documentType string, body map[string]interface{}, options ...IndexOption) (*IndexResponse, error) {
	req := a.transport.NewRequest("POST")
	for _, option := range options {
		option(req)
	}
	resp, err := a.transport.Do(req)
	return &IndexResponse{resp}, err
}

That assumpion somehow is confirmed by the response I am receiving from the request: "No handler found for uri [/] and method [POST]"

While looking at it I also saw that most of the options are not implemented aswell, am I missing some sort of magic? I am willing to contribute and I though about changing the code but saw the top statement: "// generated by github.com/elastic/go-elasticsearch/cmd/generator; DO NOT EDIT" I checked the generator and apparently generates the code from the specs in the elasticsearch project.

If you can provide information about the project status, some sort of direction on how and in what contribute and/or some sort documentation it would be of great help. (I saw the issue on the repository, but seems to be somehow incomplete?)

Thank you in advance. :hedgehog:


(system) #2

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