예제 #1
0
        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));
        }
예제 #2
0
        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");
        }
예제 #3
0
 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));
 }