elasticsearch Content-Type header [] is not supported

错误信息:

log.ESResponse {
    ID: "",
    Took: 0,
    TimeOut: false,
    Shards: log.ESShards {
        Total: 0,
        Successful: 0,
        Failed: 0
    },
    Status: 406,
    Error: "Content-Type header [] is not supported",
    Aggs: log.ESAggs {
        AllFileNameKey: log.AllFileName {
            DocCntErrUpBound: 0,
            SumOtherDocCnt: 0,
            Buckets: [] log.ESBucket(nil)
        }
    },
    Hits: log.ESHits {
        Total: 0,
        MaxScore: 0,
        Hits: [] log.ESHit(nil)
    }
}

解决办法

curl -H "Content-Type: application/json" -XPOST 'localhost:9200/books/es/1' -d '{"title":"Elasticsearch Server", "publicshed":2013}'

参考:
Http Header里的Content-Type
vue-resource Content-Type is not allowed by Access-Control-Allow-Headers in preflight response
Request header field Content-Type is not allowed by Access-Control-Allow-Headers跨域

猜你喜欢

转载自blog.csdn.net/qq_21816375/article/details/80621809
今日推荐