Golang uses Elasticsearch to report an error cannot unmarshal object into Go struct field xx of type xx

Golang uses Elasticsearch to report an error. Recently, I am learning to use Golang to use Elasticsearch. According to the online tutorial, there is no problem with local input and command input. I plan to use the webpage to operate. When postman tested, it reported err and found no problem for a long time. “err”: “json: cannot unmarshal object into Go struct field SearchHits.hits.total of type int64”

Golang uses Elasticsearch to report an error

Recently learning to use Elasticsearch with Golang
According to the online tutorial, there is no problem with local input and command input.
I plan to use the webpage to operate, and report err when postman tests
I searched for a long time and found no problem

"err": "json: cannot unmarshal object into Go struct field SearchHits.hits.total of type int64"

last changed version
The first version I found online was gopkg.in/olivere/elastic.v5
But the article said that it is now v6, so I use gopkg.in/olivere/elastic.v6
After reporting the error, change it to “github.com/olivere/elastic/v7” 👌👌

Leave a Reply

Your email address will not be published. Required fields are marked *

en_USEnglish