{"id":133,"date":"2018-06-23T19:09:03","date_gmt":"2018-06-23T19:09:03","guid":{"rendered":"http:\/\/tonysbit.blog\/?p=133"},"modified":"2018-06-23T19:09:03","modified_gmt":"2018-06-23T19:09:03","slug":"c-time-savers-for-elasticsearch","status":"publish","type":"post","link":"https:\/\/tonysbit.blog\/?p=133","title":{"rendered":"C# Time-savers for Elasticsearch"},"content":{"rendered":"

1. Context<\/h1>\n

If you are currently developing using C# (Particularly .NET Core 2.0+) here are some shortcuts I hope will be able to save you time I wish I could have back.<\/p>\n

There is official documentation for C# Elasticsearch development however I found the examples to be quite lacking. I do recommend going through the documentation <\/a>anyway especially for the NEST client as it is essential to understand Elasticsearch with C#.<\/p>\n

1. Low Level Client<\/h1>\n

“The low level client,\u00a0ElasticLowLevelClient<\/code>, is a low level, dependency free client that has no opinions about how you build and represent your requests and responses.”<\/p>\n

ElasticSearch Official Documentation<\/a><\/p><\/blockquote>\n

Unfortunately the low level client in particular has very sparse documentation especially examples. The following was discovered through googling and painstaking testing.<\/p>\n

1.1. Using\u00a0 JObjects in Elasticsearch<\/h2>\n

JObjects are quite popular way to work with JSON objects in .NET, as such it may be required to parse JObjects to Elasticsearch, this may be a result of one of the following:<\/p>\n