# Copy data from ms-sql to elasticsearch using logstash for Nested type

**URL:** <https://discuss.elastic.co/t/copy-data-from-ms-sql-to-elasticsearch-using-logstash-for-nested-type/230314>\
**Category:** Logstash\
**Created:** [April 29, 2020, 6:35am UTC](https://discuss.elastic.co/t/copy-data-from-ms-sql-to-elasticsearch-using-logstash-for-nested-type/230314 "2020-04-29T06:35:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssupale](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@ssupale](https://discuss.elastic.co/u/ssupale)\
**Post date:** [April 29, 2020, 6:35am UTC](https://discuss.elastic.co/t/copy-data-from-ms-sql-to-elasticsearch-using-logstash-for-nested-type/230314/1 "2020-04-29T06:35:19Z")

</div>

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 ?

1. 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"  
}  
}  
}  
}  
}  
}

1. 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  
}  
]  
}

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 27, 2020, 6:35am UTC](https://discuss.elastic.co/t/copy-data-from-ms-sql-to-elasticsearch-using-logstash-for-nested-type/230314/2 "2020-05-27T06:35:26Z")

</div>

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