public void CreateAnimal(Animal animal) { ValidateIfIdIsAlreadyUsedForIndex(animal.Id.ToString(CultureInfo.InvariantCulture)); var index = _elasticsearchClient.Index(animal, i => i .Index("animals") .Type("animal") .Id(animal.Id) .Refresh() .Ttl("1m") ); _logProvider.ElasticSearchProviderVerbose(string.Format("Created animal: {0}, {1}", animal.Id, animal.AnimalType)); }
public SearchProvider(ILogProvider logProvider) { _logProvider = logProvider; var uri = new Uri("http://localhost:9200"); var settings = new ConnectionSettings(uri).SetDefaultIndex("animals"); _elasticsearchClient = new ElasticClient(settings); _logProvider.ElasticSearchProviderVerbose("SearchProvider construction"); }
public void CreateAnimal(Animal animal) { ValidateIfIdIsAlreadyUsedForIndex(animal.Id.ToString(CultureInfo.InvariantCulture)); _elasticsearchClient.Index(animal, Animal.SearchIndex, "animal"); _logProvider.ElasticSearchProviderVerbose(string.Format("Created animal: {0}, {1}", animal.Id, animal.AnimalType)); }