I have a following index in Elasticsearch (Create Index Syntax is as below), This index is having a nested type for field jsonarrayversion. We also have the similar table in mssql with columns as (Id int, Name nvarchar(50), IsDeleted bit, JsonArrayVersion nvarchar (500) ). The field JsonArrayVersion is string JSON array in database. Using logstash I would like to move the records from mssql to Elasticsearch index. When I run the logstash, receiving the following error.
Error: object mapping for [jsonarrayversion] tried to parse field [jsonarrayversion] as object, but found a concrete value
What type of filter I should apply which will help me to move string JSON array to Nested Type ?
- Create Index:
PUT cs_array
{
"mappings": {
"properties": {
"id": {
"type": "long"
},
"name": {
"type": "text"
},
"isdeleted": {
"type": "boolean"
},
"jsonarrayversion": {
"type": "nested",
"properties": {
"id": {
"type": "long"
},
"name": {
"type": "text"
}
}
}
}
}
}
- Add Records to Index
POST cs_array/_doc
{
"id" : 2,
"name": "R800",
"isdeleted": false,
"jsonarrayversion": [
{
"name": "Test 1",
"id": 11
},
{
"name": "Test 2",
"id": 19
},
{
"name": "Test 3",
"id": 21
}
]
}