# Column name case changes from camel case to lowercase, when we import data to elastic from SQL DB

**URL:** <https://discuss.elastic.co/t/column-name-case-changes-from-camel-case-to-lowercase-when-we-import-data-to-elastic-from-sql-db/38368>\
**Category:** Elasticsearch\
**Created:** [January 5, 2016, 5:32am UTC](https://discuss.elastic.co/t/column-name-case-changes-from-camel-case-to-lowercase-when-we-import-data-to-elastic-from-sql-db/38368 "2016-01-05T05:32:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhijit\_Shivathare](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@Abhijit\_Shivathare](https://discuss.elastic.co/u/Abhijit_Shivathare)\
**Post date:** [January 5, 2016, 5:32am UTC](https://discuss.elastic.co/t/column-name-case-changes-from-camel-case-to-lowercase-when-we-import-data-to-elastic-from-sql-db/38368/1 "2016-01-05T05:32:27Z")

</div>

SQL DB Column names are Id , FirstName , LastName.  
When we imported data to elastic Search , the column name are changes to id, firstname , lastname.

Is there any solution to keep column name as its?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 5, 2016, 5:37am UTC](https://discuss.elastic.co/t/column-name-case-changes-from-camel-case-to-lowercase-when-we-import-data-to-elastic-from-sql-db/38368/2 "2016-01-05T05:37:19Z")

</div>

You need to do that in the mapping of the fields, you can either set them to `not_analyzed` or create your own analysis chain without the lower case analyzer.

---

<div class="post-metadata">

**Author:** ![Abhijit\_Shivathare](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@Abhijit\_Shivathare](https://discuss.elastic.co/u/Abhijit_Shivathare)\
**Post date:** [January 5, 2016, 5:46am UTC](https://discuss.elastic.co/t/column-name-case-changes-from-camel-case-to-lowercase-when-we-import-data-to-elastic-from-sql-db/38368/3 "2016-01-05T05:46:39Z")

</div>

Thanks for your replay.  
Can you please give me reference URLs.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [January 5, 2016, 6:48am UTC](https://discuss.elastic.co/t/column-name-case-changes-from-camel-case-to-lowercase-when-we-import-data-to-elastic-from-sql-db/38368/4 "2016-01-05T06:48:36Z")

</div>

How are you importing the data?

Mark's comment about field mapping applies to the value of the fields but not the name of the fields.

---

<div class="post-metadata">

**Author:** ![Abhijit\_Shivathare](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@Abhijit\_Shivathare](https://discuss.elastic.co/u/Abhijit_Shivathare)\
**Post date:** [January 5, 2016, 6:50am UTC](https://discuss.elastic.co/t/column-name-case-changes-from-camel-case-to-lowercase-when-we-import-data-to-elastic-from-sql-db/38368/5 "2016-01-05T06:50:39Z")

</div>

we are importing data using Nest.  
We have created the C# utility to import data . we read data from SQL DB and import as object into elastic search

```
        Uri ESUrl = new Uri(URL);
        string IndexArry = "discussions,discussion";
        var settings = new ConnectionSettings(ESUrl);
        var client = new ElasticClient(settings);

        try
        {
            var request = new BulkDescriptor();
            string[] IndexType = IndexArry.Split(',');
            if (IndexType.Count() > 1)
            {
                foreach (sqlDBData item in contentItems)
                {
                    request.Index<sqlDBData>(op => op
                            .Index(IndexType[0])
                            .Type(IndexType[1])
                            .Id(item.Id)
                            .Document(item)
                            );

                }
                var result = client.Bulk(request);
            }
        catch (Exception e)
        {
            string m = e.Message;
            // can do this logging thing.
        }
```

---

<div class="post-metadata">

**Author:** ![Abhijit\_Shivathare](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@Abhijit\_Shivathare](https://discuss.elastic.co/u/Abhijit_Shivathare)\
**Post date:** [January 5, 2016, 7:03am UTC](https://discuss.elastic.co/t/column-name-case-changes-from-camel-case-to-lowercase-when-we-import-data-to-elastic-from-sql-db/38368/6 "2016-01-05T07:03:14Z")

</div>

we have used Nest.dll for import the data into elastic search in C#  
Uri ESUrl = new Uri(URL);  
string IndexArry = "discussions,discussion";  
var settings = new ConnectionSettings(ESUrl);  
var client = new ElasticClient(settings);

```
        try
        {
            var request = new BulkDescriptor();
            string[] IndexType = IndexArry.Split(',');
            if (IndexType.Count() > 1)
            {
                foreach (DiscussionDbDetails item in contentItems)
                {
                    request.Index<DiscussionDbDetails>(op => op
                            .Index(IndexType[0])
                            .Type(IndexType[1])
                            .Id(item.Id)
                            .Document(item)
                            );

                }
                var result = client.Bulk(request);
            }
        }
        catch (Exception e)
        {
            string m = e.Message;
            // can do this logging thing.
        }
```

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [January 5, 2016, 7:19am UTC](https://discuss.elastic.co/t/column-name-case-changes-from-camel-case-to-lowercase-when-we-import-data-to-elastic-from-sql-db/38368/7 "2016-01-05T07:19:07Z")

</div>

I doubt the Nest client does the down-casing of the field names. Have you double-checked that the down-casing doesn't take place when DiscussionDbDetails objects are serialized to JSON?

---

<div class="post-metadata">

**Author:** ![Abhijit\_Shivathare](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@Abhijit\_Shivathare](https://discuss.elastic.co/u/Abhijit_Shivathare)\
**Post date:** [January 5, 2016, 9:53am UTC](https://discuss.elastic.co/t/column-name-case-changes-from-camel-case-to-lowercase-when-we-import-data-to-elastic-from-sql-db/38368/8 "2016-01-05T09:53:17Z")

</div>

I have cross check the Document in request which is pass to bulk insert , object is not down-casing.  
var result = client.Bulk(request)  
((Nest.BulkIndexDescriptor\<ESConnecter.DiscussionDbDetails\>)((new System.Collections.Generic.Mscorlib\_CollectionDebugView\<Nest.IBulkOperation\>(((System.Collections.Generic.SynchronizedCollection\<Nest.IBulkOperation\>)(request.Nest.IBulkRequest.Operations)).items)).Items[0])).Nest.IIndexOperation.Document  
 ![](https://us1.discourse-cdn.com/elastic/original/2X/1/1e98db957e19d1b858c79abe72cecff0e77af37f.png)

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [January 5, 2016, 10:13am UTC](https://discuss.elastic.co/t/column-name-case-changes-from-camel-case-to-lowercase-when-we-import-data-to-elastic-from-sql-db/38368/9 "2016-01-05T10:13:45Z")

</div>

That screenshot only proves that the original member names are mixed case. Anyway, this seems to be an issue with Nest after all:

- [http://stackoverflow.com/a/27296871/414355](http://stackoverflow.com/a/27296871/414355)
- [http://nest.azurewebsites.net/nest/index-type-inference.html](http://nest.azurewebsites.net/nest/index-type-inference.html)

---

<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:** [July 5, 2017, 11:27pm UTC](https://discuss.elastic.co/t/column-name-case-changes-from-camel-case-to-lowercase-when-we-import-data-to-elastic-from-sql-db/38368/10 "2017-07-05T23:27:01Z")

</div>


