Failed to save list of maps content to elasticsearch

i am trying to save list of maps contents to Elasticsearch(as nested type)and it is failing. sample code is below
package main

import (

const RegisterIndex = "register"
const KpiIndex = "kpi"

// Register & Kpi Index doc type
const RegisterDocType = "register"
const KpiDocType = "kpi"

const KpiMapping = { "mappings": { "kpi": { "properties": { "kpi": { "type": "nested" } } } } }

func main() {
fmt.Println("Hello, playground")
var List_CounterData interface{}
List_CounterData = map[string]interface{}{}
err := saveKpi(List_Counterdata)
if err != nil {
fmt.Println("error in save")

func saveKpi(kpi interface{}) error {
put1, err := elasticSearchClient.Index().
if err != nil {
fmt.Println("Failed to store Kpi , %v", err.Error())
return err
fmt.Println("Indexed %s to index %s, type %s\n", put1.Id, put1.Index, put1.Type)
return err

My List_Counterdata sample is below

List_Counterdata = [map[name: kisha] map[name: kish age: 29]]

When trying to create index, following the error

elastic: Error 400 (Bad Request): failed to parse [type=mapper_parsing_exception]

any clue?

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