# Requring object field names to be lowercase to search

**URL:** <https://discuss.elastic.co/t/requring-object-field-names-to-be-lowercase-to-search/114000>\
**Category:** Elasticsearch\
**Created:** [January 4, 2018, 1:29am UTC](https://discuss.elastic.co/t/requring-object-field-names-to-be-lowercase-to-search/114000 "2018-01-04T01:29:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![duydle](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@duydle](https://discuss.elastic.co/u/duydle)\
**Post date:** [January 4, 2018, 1:29am UTC](https://discuss.elastic.co/t/requring-object-field-names-to-be-lowercase-to-search/114000/1 "2018-01-04T01:29:20Z")

</div>

I'm experimenting with indexing my search results. It seems like I have to have my object field names to be lower case (not the data) when I create an index and populate my index to be able to do a Search via Match. If I have my object field name to be camel case, I'm unable to Search. I would like to keep my object field name camel case and be able to search my data?

---

<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 4, 2018, 1:32am UTC](https://discuss.elastic.co/t/requring-object-field-names-to-be-lowercase-to-search/114000/2 "2018-01-04T01:32:45Z")

</div>

> [@duydle](#):
>
> If I have my object field name to be camel case, I'm unable to Search

Why not?

---

<div class="post-metadata">

**Author:** ![duydle](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@duydle](https://discuss.elastic.co/u/duydle)\
**Post date:** [January 4, 2018, 3:00pm UTC](https://discuss.elastic.co/t/requring-object-field-names-to-be-lowercase-to-search/114000/3 "2018-01-04T15:00:57Z")

</div>

Here's an example: Why does my ElasticInstrument object field names have to be in lower case for my search to work?

void Main()  
{  
var settings = new ConnectionSettings(new Uri("[http://localhost:9200](http://localhost:9200)")).DefaultIndex("instruments").RequestTimeout(TimeSpan.FromMinutes(2));  
var client = new ElasticClient(settings);

```
var indexName = "instruments";
client.DeleteIndex(indexName);

SearchIndexManager.CreateIndex(indexName);
var instruments =
	(from i in Instruments
	 join ibd in InstrumentsByDays on new { EffectiveDate = DateTime.Parse("2017-08-18"), Id = i.Id } equals new { EffectiveDate = ibd.EffectiveDate, Id = ibd.InstrumentId }
	 join it in InstrumentTypes on i.InstrumentTypeId equals it.Id
	 where ibd.TradedCountry == "US"
	 select new ElasticInstrument() { id = i.Id, ticker = ibd.Ticker, sedol1 = ibd.SEDOL1, sedol2 = ibd.SEDOL2, cusip = ibd.CUSIP, isin = ibd.ISIN, figi = i.FIGI, bloombergUniqueId = ibd.BloombergUniqueId, bloombergTicker = ibd.BloombergTicker, country = ibd.TradedCountry, currency = ibd.Currency, primaryExchangeCode = ibd.PrimaryExchangeCode, exchangeCode = ibd.ExchangeCode, instrumentType = it.Name, bloombergSecurityType = i.BloombergSecurityType, bloombergSecurityType2 = i.BloombergSecurityType2 }).Take(100).ToList();
var results = SearchIndexManager.BuildIndexBulk(instruments, 10, indexName, "elasticinstrument");

	var result = SearchClient.SearchByTerm("BBG000BPH459");
	result.Dump();

```

}

public static class SearchClient  
{  
public static List SearchByTicker(string searchValue)  
{  
var settings = new ConnectionSettings(new Uri("[http://localhost:9200](http://localhost:9200)")).DefaultIndex("instruments").RequestTimeout(TimeSpan.FromMinutes(2));  
var client = new ElasticClient(settings);  
var response = client.Search(s =\> s.Query(q =\>q.Match(m =\> m.Field(f =\> f.ticker).Query(searchValue)))).Documents.ToList();  
return response;  
}  
}

public static class SearchIndexManager  
{  
public static void CreateIndex(string name)  
{  
var settings = new ConnectionSettings(new Uri("[http://localhost:9200](http://localhost:9200)")).DefaultIndex("instruments").RequestTimeout(TimeSpan.FromMinutes(2));  
var client = new ElasticClient(settings);  
client.CreateIndex(name, c =\> c  
.Mappings(m =\> m.Map(mp =\> mp.AutoMap())));  
}

```
public static List<ElasticsearchResponse<Stream>> BuildIndexBulk(List<ElasticInstrument> instruments, int batchSize, string index, string indexType)
{

	var bulkInstrumentsForIndexing = new List<object>();
	var responses = new List<ElasticsearchResponse<Stream>>();
	int totalRecords = instruments.Count();

	var settings = new ConnectionConfiguration(new Uri("http://localhost:9200")).RequestTimeout(TimeSpan.FromMinutes(10));
	var client = new ElasticLowLevelClient(settings);

	for (int i = 0; i < totalRecords; i = i + batchSize)
	{
		var items = instruments.Skip(i).Take(batchSize);
		foreach (var e in items)
		{
			var objIndex = new { index = new { _index = index, _type = indexType, _id = e.id } };
			bulkInstrumentsForIndexing.Add(objIndex);
			bulkInstrumentsForIndexing.Add(e);
		}

		var indexResponse = client.Bulk<Stream>(bulkInstrumentsForIndexing);
		responses.Add(indexResponse);
		bulkInstrumentsForIndexing.Clear(); //clear for next batch
	}

	return responses;
}

```

}

public class ElasticInstrument  
{  
**// Why do field names need to be in lower case for search to work?**  
public int id { get; set; }  
public string ticker { get; set; }  
public string sedol1 { get; set; }  
public string sedol2 { get; set; }  
public string cusip { get; set; }  
public string isin { get; set; }  
public string figi { get; set; }  
public string bloombergUniqueId { get; set; }  
public string bloombergTicker { get; set; }  
public string country { get; set; }  
public string currency { get; set; }  
public string exchangeCode { get; set; }  
public string primaryExchangeCode { get; set; }  
public string instrumentType { get; set; }  
public string bloombergSecurityType { get; set; }  
public string bloombergSecurityType2 { get; set; }  
}

---

<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:** [February 1, 2018, 3:01pm UTC](https://discuss.elastic.co/t/requring-object-field-names-to-be-lowercase-to-search/114000/4 "2018-02-01T15:01:09Z")

</div>

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