# Kibana vs NEST, not getting same result?

**URL:** <https://discuss.elastic.co/t/kibana-vs-nest-not-getting-same-result/105857>\
**Category:** Elasticsearch\
**Created:** [October 31, 2017, 9:30am UTC](https://discuss.elastic.co/t/kibana-vs-nest-not-getting-same-result/105857 "2017-10-31T09:30:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SparkyRih](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sparkyrih/32/24762_2.png) [@SparkyRih](https://discuss.elastic.co/u/SparkyRih)\
**Post date:** [October 31, 2017, 9:30am UTC](https://discuss.elastic.co/t/kibana-vs-nest-not-getting-same-result/105857/1 "2017-10-31T09:30:34Z")

</div>

I'm new to Elasticsearch. I'm building a C# service, which will use Elasticsearch to search error logs.

Now I'm trying to make an aggregation, when I try to run the following query in Kibana, it returns 2 aggregations as expected:

GET /live/\_search  
{  
"query": {  
"match": {  
"Organisation": {  
"query": "Schattorie Solutions"  
}  
}  
},  
"aggs": {  
"ID": {  
"terms": {  
"field": "ErrorID.keyword"  
}  
}  
}  
}

But when I try the following code in C# using the NEST library, I'm getting the same hits. But there is only one aggregation with an ID Key, instead of 2 aggregations with the ErrorID values as the Key...  
var recordResponse = await client.SearchAsync(s =\> s.AllTypes()  
.Query(q =\> q  
.Match(mq =\> mq.Field("Organisation").Query("Schattorie Solutions"))  
)  
.Aggregations(a =\> a  
.Terms("ID", st =\> st  
.Field(o =\> o.ErrorID.Suffix("keyword"))  
)  
)  
);

What am I doing wrong?

**Edit:** I think I got it, the In Kibana I'm looking for "ErrorID.keyword", while the NEST parses JSON which uses "errorID.keyword"...

Is it bas practice to start fields with a capital letter? That's the way modesl are defined in C#, and based on that "LogItem" model the document is created and read...

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [November 1, 2017, 6:56am UTC](https://discuss.elastic.co/t/kibana-vs-nest-not-getting-same-result/105857/2 "2017-11-01T06:56:21Z")

</div>

NEST by default camelcases POCO property names when serializing them to JSON. This was an early design decision within the client that has continued to be the default.

You can change how NEST serializes property names through `.DefaultFieldNameInferrer(Func<string, string>)` on `ConnectionSettings`

---

<div class="post-metadata">

**Author:** ![SparkyRih](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sparkyrih/32/24762_2.png) [@SparkyRih](https://discuss.elastic.co/u/SparkyRih)\
**Post date:** [November 1, 2017, 3:55pm UTC](https://discuss.elastic.co/t/kibana-vs-nest-not-getting-same-result/105857/3 "2017-11-01T15:55:45Z")

</div>

Well, I've refactored my code for now... But thanks for the advise, I'll look into that later...

---

<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:** [November 29, 2017, 3:55pm UTC](https://discuss.elastic.co/t/kibana-vs-nest-not-getting-same-result/105857/4 "2017-11-29T15:55:47Z")

</div>

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