Mapper Parsing Exception while creating index

I create index with

client.admin().indices().preparePutMapping(indexName)
.setType(documentType)
.setSource(builder)
.get();

builder.startObject(SearchDocumentFieldName.TIMESTAMP.getFieldName())
.field("type" "long")
.field("index","not_analyzed")
.endObject()
.startArray("arrays")
.startObject()
.field("type"), "string")
.field("index", "not_analyzed")
.endObject()
.endArray();

output:
{
"documentname" : {
"dynamic" : "strict",
"_all" : {
"enabled" : false
},
"properties" : {
"timestamp" : {
"type" : "long",
"index" : "not_analyzed"
},
"arrays" : [ {
"type" : "string",
"index" : "not_analyzed"
} ]
}
}

ERRORr:MapperParsingException[Expected map for property [fields] on field [arrays] but got a class java.lang.String
]

Please take a look at the datatype assignment doc below:

https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html

Arrays do not require type assignment.

Thanks Jimmy.I solved my problem with nested object

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