In 2.0 alpha for nest I am struggling to set the DefaultFieldNameInferrer
to camelCase.
After figuring out how to view the 'request body' (by explicity setting the DisableDirectStreaming
to true, despite the default is true...), I can see that for a request like:
...fil.Bool(b2 => b2.Must(m => m.Term(t => t.DomainName, host))))...
it is sending DomainName
with a captial D
:
...{"term":{"DomainName":{"value":"example.com"}}}]}...
Version 1.7 always sent camelCase and hence my mappings are all camelCase.
How can I change this back to camelCase?
Edit
Connection:
ElasticClient = new ElasticClient
(new ConnectionSettings(new Uri(WebConfigMethods.GetElasticSearchUri())).MapDefaultTypeIndices
(new ElasticsearchMethods().ElasticSearchDefaultTypeIndices)
.DisableDirectStreaming(true)
.DefaultFieldNameInferrer
(s =>
{
if (string.IsNullOrEmpty(s))
return s;
if (!char.IsUpper(s[0]))
return s;
string camelCase = char.ToLower(s[0], CultureInfo.InvariantCulture)
.ToString(CultureInfo.InvariantCulture);
if (s.Length > 1)
camelCase += s.Substring(1);
return camelCase;
}));
Request:
var result = elasticClient.Search<ADocType>
(s => s.Take(1)
.Query
(qu =>
qu.Bool
(b => b.Filter(fil => fil.Bool(b2 => b2.Must(m => m.Term(t => t.DomainName, host)))))));
What nest actually sends:
{"size":1,"query":{"bool":{"filter":[{"bool":{"must":[{"term":{"DomainName":{"value":"example.com"}}}]}}]}}}