private async Task CreateElasticsearchTemplateAsync()
        {
            string uri         = $"_template/{ConfigurationManager.ElasticSearchIndex}_rts";
            var    getResponse = await m_client.GetAsync(uri);

            if (getResponse.StatusCode != HttpStatusCode.NotFound)
            {
                return;
            }

            var context           = new SphDataContext();
            var entityDefinitions = context.LoadFromSources <EntityDefinition>();
            var mappings          = from ed in entityDefinitions
                                    where !ExcludeTypes.Contains(ed.Name)
                                    let map                       = ed.GetElasticsearchMapping().Trim()
                                                         let trim = map.Trim()
                                                                    select trim.Substring(1, trim.Length - 2).Trim();

            var template = $@"
{{
  ""template"": ""{ConfigurationManager.ElasticSearchIndex}_rts_*"",
  ""aliases"": {{
    ""{ConfigurationManager.ElasticSearchIndex}_rts"": {{}}
  }},
  ""mappings"": {{
        {mappings.ToString(",\r\n")}
  }}
}}";
            var response = await m_client.PutAsync(uri, new StringContent(template));

            response.EnsureSuccessStatusCode();
        }