private static void Index(Document document, String operation)
        {
            var uriString = ConfigurationManager.AppSettings["SEARCHBOX_URL"];
            var searchBoxUri = new Uri(uriString);

            var settings = new ConnectionSettings(searchBoxUri);
            settings.SetDefaultIndex("sample");

            var client = new ElasticClient(settings);

            if (!client.IndexExists("sample").Exists)
            {
                // Create a new "sample" index with default settings
                client.CreateIndex("sample", new IndexSettings());
            }

            if (operation.Equals("delete"))
            {
                client.DeleteById("sample", "documents", document.DocumentId);
            }
            else
            {
                client.Index(document, "sample", "documents", document.DocumentId);
            }
        }
        private static void Index(Document document, String operation)
        {
            var uriString = ConfigurationManager.AppSettings["SEARCHBOX_URL"];
            var searchBoxUri = new Uri(uriString);

            var settings = new ConnectionSettings(searchBoxUri);
            settings.SetDefaultIndex("sample");

            var client = new ElasticClient(settings);

            if (operation.Equals("delete"))
            {
                ConnectionStatus status = client.DeleteById("sample", "documents", document.DocumentId);
            }
            else
            {
                client.Index(document, "sample", "documents", document.DocumentId);
            }
        }