public override void ContributeCore(CreateIndexDescriptor descriptor, IElasticClient client) { if (_shards.HasValue && _shards.Value > 0) { descriptor.NumberOfShards(_shards.Value); } }
public override async Task TeardownAsync(IElasticClient client, ColoredConsoleWriter output) { var deleteResponse = await client.DeleteAsync<Developer>(_developer, d => d.Index<Developer>()).ConfigureAwait(false); if (!deleteResponse.IsValid) output.WriteOrange($"error with id {deleteResponse.Id}. message: {deleteResponse.CallDetails.OriginalException}"); }
public Repository() { //_passportIndices = new List<string> {ServiceIndex, UserIndex, ClaimIndex, OrgIndex}; var storage = new Storage("http://localhost:9200"); _client = storage.Connection; //InitialiseConnection(); }
public override async Task ProfileAsync(IElasticClient client, ColoredConsoleWriter output) { for (var i = 0; i < _iterations; i++) { // TODO generate random search descriptors var searchResponse = await client.SearchAsync<Developer>(s => s .Index<Developer>() .Query(q => q .Bool(b => b .Must( mc => mc.Match(m => m.Field(d => d.FirstName).Query(_developer.FirstName)), mc => mc.Match(m => m.Field(d => d.LastName).Query(_developer.LastName)), mc => mc.Match(m => m.Field(d => d.JobTitle).Query(_developer.JobTitle)) ) ) ) ).ConfigureAwait(false); if (!searchResponse.IsValid) output.WriteOrange( $"error searching for {nameof(Developer)}. message: {searchResponse.CallDetails.OriginalException}"); if (!searchResponse.Documents.Any()) output.WriteOrange($"did not find matching {nameof(Developer)} for search."); } }
public BaseJsonTests() { this._settings = new ConnectionSettings(Test.Default.Uri) .SetDefaultIndex(Test.Default.DefaultIndex); this._connection = new InMemoryConnection(this._settings); this._client = new ElasticClient(this._settings, this._connection); }
public override void ContributeCore(CreateIndexDescriptor descriptor, IElasticClient client) { foreach (var contributor in _contributors) { contributor.Contribute(descriptor, client); } }
public BaseJsonTests() { this._settings = new ConnectionSettings(UnitTestDefaults.Uri, UnitTestDefaults.DefaultIndex) .ExposeRawResponse(); this._connection = new InMemoryConnection(this._settings); this._client = new ElasticClient(this._settings, this._connection); }
/// <summary> /// C/tor /// </summary> /// <param name="namedLock">The name of the lock to create. REQUIRED</param> /// <param name="client">An instance of an elastic search NEST client. Will be created automatically by default. Use this if connecting to an elastic cluster.</param> /// <param name="indexName">The name of the elastic search index. Default = distributedlocks</param> public ElasticSearchDistributedLock(string namedLock, IElasticClient client = null, string indexName = "distributedlocks") { if (string.IsNullOrEmpty(namedLock)) throw new ArgumentException("namedLock cannot be null or empty"); mIndex = indexName; Name = namedLock; mStopwatch = new Stopwatch(); //Only do this once per process.. if (string.IsNullOrEmpty(mOwner)) { mOwner = BuildOwnerIdentifier(); } //Create a default client if none handed in if (client == null) { var settings = new ConnectionSettings(defaultIndex: mIndex); mClient = new ElasticClient(settings); } else { mClient = client; } }
public void Initialize(string uri = "http://localhost:9200/", bool deleteIndex = false) { _logger.Info("Initialing elastic search with uri: " + uri); var connectionString = new ConnectionSettings( new Uri(uri)) .DefaultIndex(OSM_NAMES_INDEX) .PrettyJson(); _elasticClient = new ElasticClient(connectionString); if (deleteIndex && _elasticClient.IndexExists(OSM_NAMES_INDEX).Exists) { _elasticClient.DeleteIndex(OSM_NAMES_INDEX); } if (deleteIndex && _elasticClient.IndexExists(OSM_HIGHWAYS_INDEX).Exists) { _elasticClient.DeleteIndex(OSM_HIGHWAYS_INDEX); } _elasticClient.CreateIndex(OSM_HIGHWAYS_INDEX, c => c.Mappings( ms => ms.Map<object>(m => m.Properties(ps => ps.GeoShape(g => g.Name("geometry") .Tree(GeoTree.Geohash) .TreeLevels(10) .DistanceErrorPercentage(0.2)))))); _logger.Info("Finished initialing elastic search with uri: " + uri); }
public static string CreateNewIndexWithData(IElasticClient client) { var newIndex = ElasticsearchConfiguration.NewUniqueIndexName(); CreateTestIndex(client, newIndex); IndexDemoData(client, newIndex); return newIndex; }
public static IEnumerable<QueryResponse<JsonObject>> Do(IElasticClient client) { var d = new MultiSearchDescriptor(); d.Search<JsonObject>(s => s.Index("entities") .Type("locations") .ConcreteTypeSelector((o, hit) => typeof (JsonObject)) .FacetQuery("one", q => q.QueryString(a => a.Query("parentId:59791"))) .FacetQuery("two", q => q.QueryString(a => a.Query("parentId:7309")))); d.Search<JsonObject>(s => s.Index("entities") .Type("locations") .ConcreteTypeSelector((o, hit) => typeof (JsonObject)) .FacetQuery("facetName", q => q.QueryString(a => a.Query("parentId:7309")))); d.Search<JsonObject>(s => s.Index("entities") .Type("locations") .ConcreteTypeSelector((o, hit) => typeof (JsonObject)) .FacetQuery("facetName", q => q.QueryString(a => a.Query("parentId:12711")))); d.Search<JsonObject>(s => s.Index("entities") .Type("locations") .ConcreteTypeSelector((o, hit) => typeof (JsonObject)) .FacetQuery("facetName", q => q.QueryString(a => a.Query("parentId:60068")))); var b = client.MultiSearch(d); return b.GetResponses<JsonObject>(); }
public static void CreateTestIndex(IElasticClient client, string indexName) { var createIndexResult = client.CreateIndex(indexName, c => c .NumberOfReplicas(ElasticsearchConfiguration.NumberOfReplicas) .NumberOfShards(ElasticsearchConfiguration.NumberOfShards) .AddMapping<ElasticsearchProject>(m => m .MapFromAttributes() .Properties(props => props .String(s => s .Name(p => p.Name) .FieldData(fd => fd.Loading(FieldDataLoading.Eager)) .Fields(fields => fields .String(ss => ss .Name("sort") .Index(FieldIndexOption.NotAnalyzed) ) ) ) .String(s => s .Name(ep => ep.Content) .TermVector(TermVectorOption.WithPositionsOffsetsPayloads) ) ) ) .AddAlias(indexName + "-aliased") .AddMapping<Person>(m => m.MapFromAttributes()) .AddMapping<BoolTerm>(m => m.Properties(pp => pp .String(sm => sm.Name(p => p.Name1).Index(FieldIndexOption.NotAnalyzed)) .String(sm => sm.Name(p => p.Name2).Index(FieldIndexOption.NotAnalyzed)) )) ); createIndexResult.IsValid.Should().BeTrue(); }
public ElasticsearchRepositoryDocumentNotExistsSpecs() { var settings = new ConnectionSettings(); _client = new ElasticClient(settings, new InMemoryConnection(settings, string.Empty, 404)); _repository = new ElasticsearchRepository(_client); }
public static void IndexDemoData(IElasticClient client, string index = null) { index = index ?? ElasticsearchConfiguration.DefaultIndex; var projects = NestTestData.Data; var people = NestTestData.People; var boolTerms = NestTestData.BoolTerms; var parents = NestTestData.Parents; var children = NestTestData.Children; var bulkResponse = client.Bulk(b => { b.FixedPath(index); b.IndexMany(projects); b.IndexMany(people); b.IndexMany(boolTerms); var rand = new Random(); foreach (var parent in parents) b.Index<Parent>(i => i.Document(parent)); foreach (var child in children) b.Index<Child>(i => i .Document(child) .Parent(parents[rand.Next(parents.Count)].Id) ); b.Refresh(); return b; }); }
public SystemHealthChecker(ICacheClient cacheClient, IElasticClient elasticClient, IFileStorage storage, IQueue<StatusMessage> queue, IMessageBus messageBus) { _cacheClient = cacheClient; _elasticClient = elasticClient; _storage = storage; _queue = queue; _messageBus = messageBus; }
private static bool ValidateIfIdIsAlreadyUsedForIndex(int id, IElasticClient client) { var idsList = new List<string> { id.ToString() }; var result = client.Search<Person>(s => s .AllTypes() .Query(p => p.Ids(idsList))); return !result.Documents.Any(); }
public virtual void ConfigureIndexes(IElasticClient client, IEnumerable<IElasticIndex> indexes = null) { if (indexes == null) indexes = GetIndexes(); foreach (var idx in indexes) { int currentVersion = GetAliasVersion(client, idx.AliasName); IIndicesOperationResponse response = null; var templatedIndex = idx as ITemplatedElasticIndex; if (templatedIndex != null) response = client.PutTemplate(idx.VersionedName, template => templatedIndex.CreateTemplate(template).AddAlias(idx.AliasName)); else if (!client.IndexExists(idx.VersionedName).Exists) response = client.CreateIndex(idx.VersionedName, descriptor => idx.CreateIndex(descriptor).AddAlias(idx.AliasName)); Debug.Assert(response == null || response.IsValid, response?.ServerError != null ? response.ServerError.Error : "An error occurred creating the index or template."); // Add existing indexes to the alias. if (!client.AliasExists(idx.AliasName).Exists) { if (templatedIndex != null) { var indices = client.IndicesStats().Indices.Where(kvp => kvp.Key.StartsWith(idx.VersionedName)).Select(kvp => kvp.Key).ToList(); if (indices.Count > 0) { var descriptor = new AliasDescriptor(); foreach (string name in indices) descriptor.Add(add => add.Index(name).Alias(idx.AliasName)); response = client.Alias(descriptor); } } else { response = client.Alias(a => a.Add(add => add.Index(idx.VersionedName).Alias(idx.AliasName))); } Debug.Assert(response != null && response.IsValid, response?.ServerError != null ? response.ServerError.Error : "An error occurred creating the alias."); } // already on current version if (currentVersion >= idx.Version || currentVersion < 1) continue; var reindexWorkItem = new ReindexWorkItem { OldIndex = String.Concat(idx.AliasName, "-v", currentVersion), NewIndex = idx.VersionedName, Alias = idx.AliasName, DeleteOld = true, ParentMaps = idx.GetIndexTypes() .Select(kvp => new ParentMap {Type = kvp.Value.Name, ParentPath = kvp.Value.ParentPath}) .Where(m => !String.IsNullOrEmpty(m.ParentPath)) .ToList() }; bool isReindexing = _lockProvider.IsLockedAsync(String.Concat("reindex:", reindexWorkItem.Alias, reindexWorkItem.OldIndex, reindexWorkItem.NewIndex)).Result; // already reindexing if (isReindexing) continue; // enqueue reindex to new version _lockProvider.TryUsingAsync("enqueue-reindex", () => _workItemQueue.EnqueueAsync(reindexWorkItem), TimeSpan.Zero, CancellationToken.None).Wait(); } }
public ElasticSearcher(IClientProvider clientProvider, IElasticConnectionSettings elasticConnectionSettings) { if (clientProvider == null) throw new ArgumentNullException("clientProvider"); if (elasticConnectionSettings == null) throw new ArgumentNullException("elasticConnectionSettings"); _clientProvider = clientProvider; _elasticConnectionSettings = elasticConnectionSettings; _client = _clientProvider.GetClient(_elasticConnectionSettings); }
public override async Task SetupAsync(IElasticClient client, ColoredConsoleWriter output) { _developer = Developer.Generator.Generate(); var indexResponse = await client.IndexAsync(_developer, d => d.Index<Developer>().Refresh()).ConfigureAwait(false); if (!indexResponse.IsValid) output.WriteOrange($"error with id {indexResponse.Id}. message: {indexResponse.CallDetails.OriginalException}"); }
public EmployeeRepositoryTests() { _queryBuilder.RegisterDefaults(); _queryBuilder.Register(new AgeQueryBuilder()); _configuration = new ElasticConfiguration(_workItemQueue, _cache); _client = _configuration.GetClient(new[] { new Uri(ConfigurationManager.ConnectionStrings["ElasticConnectionString"].ConnectionString) }); _repository = new EmployeeRepository(new ElasticRepositoryContext<Employee>(_cache, _client, _configuration, null, null, _queryBuilder)); _repositoryWithDateBasedIndex = new EmployeeWithDateBasedIndexRepository(new ElasticRepositoryContext<EmployeeWithDate>(_cache, _client, _configuration, null, null, _queryBuilder), _employeeWithDateIndex); }
public ElasticsearchRepositoryGetByIdSpecs() { var settings = new ConnectionSettings(); var output = "Nest.Queryify.Tests.TestData.ValidGetResponse.json".ReadAsStringFromEmbeddedResource<ElasticClientQueryObjectTestFixture>(); _client = new ElasticClient(settings, new InMemoryConnection(settings, output)); _repository = new ElasticsearchRepository(_client); }
public PageDataIndexer(ILanguageBranchRepository languageBranchRepository,IElasticClient elasticClient, CmsElasticSearchOptions options, IContentRepository contentRepository, IIndexableTypeMapperResolver indexableTypeMapperResolver, ILogger logger) { LanguageBranchRepository = languageBranchRepository; ElasticClient = elasticClient; Options = options; _contentRepository = contentRepository; _indexableTypeMapperResolver = indexableTypeMapperResolver; _logger = logger; }
public override async Task ProfileAsync(IElasticClient client, ColoredConsoleWriter output) { for (var i = 0; i < _iterations; i++) { var mappingResponse = await client.GetMappingAsync<Project>(s => s.Index<Project>()).ConfigureAwait(false); if (!mappingResponse.IsValid) output.WriteOrange("Invalid response for get mapping operation"); } }
public override async Task ProfileAsync(IElasticClient client, ColoredConsoleWriter output) { for (var i = 0; i < _iterations; i++) { var indexResponse = await client.IndexAsync(Developer.Generator.Generate(), d => d.Index<Developer>()).ConfigureAwait(false); if (!indexResponse.IsValid) output.WriteOrange($"error with id {indexResponse.Id}. message: {indexResponse.ApiCall.OriginalException}"); } }
public MigrationJobBase(IElasticClient elasticClient, EventUpgraderPluginManager eventUpgraderPluginManager, EventIndex eventIndex, StackIndex stackIndex, IValidator<Stack> stackValidator, IValidator<PersistentEvent> eventValidator, IGeoIPResolver geoIpResolver, ILockProvider lockProvider, ICacheClient cache) { _eventUpgraderPluginManager = eventUpgraderPluginManager; _mongoDatabase = GetMongoDatabase(); _eventRepository = new EventMigrationRepository(elasticClient, eventIndex, eventValidator); _stackRepository = new StackMigrationRepository(elasticClient, stackIndex, _eventRepository, stackValidator); _geoIpResolver = geoIpResolver; _lockProvider = lockProvider; _cache = cache; _batchSize = MigrationSettings.Current.MigrationBatchSize; }
public override async Task TeardownAsync(IElasticClient client, ColoredConsoleWriter output) { var removeResponse = await client.AliasAsync(a => a .Remove(remove => remove .Alias(_aliasName) .Index<Developer>() )).ConfigureAwait(false); if (!removeResponse.IsValid) output.WriteOrange($"Invalid response when adding alias for {nameof(AliasExistsAsyncOperation)} operation"); }
public static IQueryResponse<JsonObject> Do(IElasticClient client) { var sed = new SearchDescriptor<JsonObject>(); sed.Index("entities").Type("locations").ConcreteTypeSelector((o, hit) => typeof (JsonObject)); sed.FacetQuery("one", q => q.QueryString(a => a.Query("parentId:59791"))); sed.FacetQuery("two", q => q.QueryString(a => a.Query("parentId:7309"))); return client.Search(sed); }
public ElasticRepositoryTestBase(ITestOutputHelper output) : base(output) { SystemClock.Reset(); Log.MinimumLevel = LogLevel.Trace; Log.SetLogLevel<ScheduledTimer>(LogLevel.Warning); _cache = new InMemoryCacheClient(Log); _messgeBus = new InMemoryMessageBus(Log); _workItemQueue = new InMemoryQueue<WorkItemData>(loggerFactory: Log); _configuration = new MyAppElasticConfiguration(_workItemQueue, _cache, _messgeBus, Log); _client = _configuration.Client; }
public override async Task ProfileAsync(IElasticClient client, ColoredConsoleWriter output) { for (var i = 0; i < _iterations; i++) { var catAllocationAsync = client.CatAllocationAsync(s => s.V()); var catCountAsync = client.CatCountAsync(s => s.V()); var catFielddataAsync = client.CatFielddataAsync(s => s.V()); var catHealthAsync = client.CatHealthAsync(s => s.V()); var catIndicesAsync = client.CatIndicesAsync(s => s.V()); var catNodesAsync = client.CatNodesAsync(s => s.V()); var catPendingTasksAsync = client.CatPendingTasksAsync(s => s.V()); var catThreadPoolAsync = client.CatThreadPoolAsync(s => s.V()); var catAliasesAsync = client.CatAliasesAsync(s => s.V()); await Task.WhenAll( catAllocationAsync, catCountAsync, catFielddataAsync, catHealthAsync, catIndicesAsync, catNodesAsync, catPendingTasksAsync, catThreadPoolAsync, catAliasesAsync ).ConfigureAwait(false); if (!catAllocationAsync.Result.IsValid) output.WriteOrange("invalid response received for cat allocation"); if (!catCountAsync.Result.IsValid) output.WriteOrange("invalid response received for cat count"); if (!catFielddataAsync.Result.IsValid) output.WriteOrange("invalid response received for cat fielddata"); if (!catHealthAsync.Result.IsValid) output.WriteOrange("invalid response received for cat health"); if (!catIndicesAsync.Result.IsValid) output.WriteOrange("invalid response received for cat indices"); if (!catNodesAsync.Result.IsValid) output.WriteOrange("invalid response received for cat nodes"); if (!catPendingTasksAsync.Result.IsValid) output.WriteOrange("invalid response received for cat pending tasks"); if (!catThreadPoolAsync.Result.IsValid) output.WriteOrange("invalid response received for cat thread pool"); if (!catAliasesAsync.Result.IsValid) output.WriteOrange("invalid response received for cat aliases"); } }
public void Contribute(CreateIndexDescriptor descriptor, IElasticClient client) { if (CanContribute(descriptor, client)) { ContributeCore(descriptor, client); ContributionComplete(); } else { ContributionRejected(); } }
protected virtual void BeforeAllCalls(IElasticClient client, IDictionary <ClientCall, string> values) { }
public static Task <DeleteSnapshotResponse> DeleteSnapshotAsync(this IElasticClient client, Name repository, Name snapshotName, Func <DeleteSnapshotDescriptor, IDeleteSnapshotRequest> selector = null, CancellationToken ct = default ) => client.Snapshot.DeleteAsync(repository, snapshotName, selector, ct);
public UserController(IElasticClient elasticClient) { _elasticClient = elasticClient; }
public MemberRepository(IElasticClient elasticClient) : base(elasticClient, "Member") { }
public static DeleteSnapshotResponse DeleteSnapshot(this IElasticClient client, Name repository, Name snapshotName, Func <DeleteSnapshotDescriptor, IDeleteSnapshotRequest> selector = null ) => client.Snapshot.Delete(repository, snapshotName, selector);
protected ContentIndexService(IElasticClient client, UmbracoContext umbracoContext, FromConfigSearchSettings searchSettings) : base(client, umbracoContext, searchSettings) { }
protected override void OnAfterCall(IElasticClient client) => client.Refresh(CallIsolatedValue);
protected virtual void IntegrationSetup(IElasticClient client, CallUniqueValues values) { }
protected virtual void OnBeforeCall(IElasticClient client) { }
public EmployeeSupervisor(IElasticConnection elasticConnection, IElasticClient IElasticClient) { _IElasticConnection = elasticConnection; _IElasticClient = IElasticClient; }
public Task RunAsync(IElasticClient client, ColoredConsoleWriter output) { throw new NotImplementedException(); }
protected override void IntegrationSetup(IElasticClient client, CallUniqueValues values) { // set up a watch that can be acknowledged foreach (var callUniqueValue in values) { var watchId = callUniqueValue.Value; var putWatchResponse = client.PutWatch(watchId, p => p .Input(i => i .Simple(s => s .Add("payload", new { send = "yes" }) ) ) .Trigger(t => t .Schedule(s => s .Hourly(h => h .Minute(0, 5) ) ) ) .Condition(co => co .Always() ) .Actions(a => a .Index("test_index", i => i .ThrottlePeriod("15m") .Index("test-" + CallIsolatedValue) .DocType("acknowledgement") ) ) ); if (!putWatchResponse.IsValid) { throw new Exception("Problem setting up PutWatch for integration test"); } var getWatchResponse = client.GetWatch(watchId); if (!getWatchResponse.IsValid) { throw new Exception("Problem with GetWatch for integration test"); } getWatchResponse.Status.Actions["test_index"].Acknowledgement.State.Should().Be(AcknowledgementState.AwaitsSuccessfulExecution); var executeWatchResponse = client.ExecuteWatch(e => e .Id(watchId) .RecordExecution() ); if (!executeWatchResponse.IsValid) { throw new Exception("Problem with ExecuteWatch for integration test"); } getWatchResponse = client.GetWatch(watchId); if (!getWatchResponse.IsValid) { throw new Exception("Problem with GetWatch for integration test"); } getWatchResponse.Status.Actions["test_index"].Acknowledgement.State.Should().Be(AcknowledgementState.Acknowledgable); } }
protected override void OnAfterCall(IElasticClient client) { client.ClearScroll(cs => cs.ScrollId(_scrollId)); }
public ReindexObservable(IElasticClient client, IConnectionSettingsValues connectionSettings, ReindexDescriptor <T> reindexDescriptor) { this._connectionSettings = connectionSettings; this._reindexDescriptor = reindexDescriptor; this.CurrentClient = client; }
protected override void IntegrationSetup(IElasticClient client, CallUniqueValues values) { foreach (var callUniqueValue in values) { var putWatchResponse = client.Watcher.Put(callUniqueValue.Value, p => p .Input(i => i .Search(s => s .Request(r => r .Indices("logstash") .Body <object>(b => b .Query(q => q .Match(m => m .Field("response") .Query("404") ) && +q .DateRange(ffrr => ffrr .Field("@timestamp") .GreaterThanOrEquals("{{ctx.trigger.scheduled_time}}||-5m") .LessThanOrEquals("{{ctx.trigger.triggered_time}}") ) ) ) ) ) ) .Condition(c => c .Script(ss => ss .Source("ctx.payload.hits.total > 1") ) ) .Trigger(t => t .Schedule(s => s .Cron("0 0 0 1 * ? 2099") ) ) .Metadata(meta => meta.Add("foo", "bar")) .Actions(a => a .Email("email_admin", e => e .To("*****@*****.**") .Subject("404 recently encountered") ) .Index("index_action", i => i .Index("test") ) .Logging("logging_action", l => l .Text("404 recently encountered") ) .Webhook("webhook_action", w => w .Host("foo.com") .Port(80) .Path("/bar") .Method(HttpInputMethod.Post) .Body("{}") ) .PagerDuty("pagerduty_action", pd => pd .Account("my_pagerduty_account") .Description("pager duty description") .AttachPayload() .EventType(PagerDutyEventType.Trigger) .IncidentKey("incident_key") .Context(c => c .Context(PagerDutyContextType.Image, cd => cd .Src("http://example.com/image") ) .Context(PagerDutyContextType.Link, cd => cd .Href("http://example.com/link") ) ) ) .Slack("slack_action", sl => sl .Account("monitoring") .Message(sm => sm .From("nest integration test") .To("#nest") .Text("slack message") .Attachments(sa => sa .Attachment(saa => saa .Title("Attachment 1") .AuthorName("Russ Cam") ) ) ) ) ) ); if (!putWatchResponse.IsValid) { throw new Exception("Problem setting up integration test"); } } }
protected virtual void OnAfterCall(IElasticClient client) { }
protected override void IntegrationSetup(IElasticClient client, CallUniqueValues values) { foreach (var callUniqueValue in values) { var putWatchResponse = client.Watcher.Put(callUniqueValue.Value, p => p .Input(i => i .Search(s => s .Request(r => r .Indices("logstash") .Body <object>(b => b .Query(q => q .Match(m => m .Field("response") .Query("404") ) && +q .DateRange(ffrr => ffrr .Field("@timestamp") .GreaterThanOrEquals("{{ctx.trigger.scheduled_time}}||-5m") .LessThanOrEquals("{{ctx.trigger.triggered_time}}") ) ) ) ) ) ) .Condition(c => c .Script(ss => ss .Source("ctx.payload.hits.total > 1") ) ) .Trigger(t => t .Schedule(s => s .Cron("0 0 0 1 * ? 2099") ) ) .Metadata(meta => meta.Add("foo", "bar")) .Actions(a => a .Email("email_admin", e => e .To("*****@*****.**") .Subject("404 recently encountered") ) .Index("index_action", i => i .Index("test") ) .Logging("logging_action", l => l .Text("404 recently encountered") ) .Webhook("webhook_action", w => w .Host("foo.com") .Port(80) .Path("/bar") .Method(HttpInputMethod.Post) .Body("{}") ) ) ); if (!putWatchResponse.IsValid) { throw new Exception("Problem setting up integration test"); } } }
/// <summary> /// SourceMany allows you to get a list of T documents out of Elasticsearch, internally it calls into MultiGet() /// <para> /// Multi GET API allows to get multiple documents based on an index, type (optional) and id (and possibly routing). /// The response includes a docs array with all the fetched documents, each element similar in structure to a document /// provided by the get API. /// </para> /// <para> </para> /// >http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-multi-get.html /// </summary> /// <typeparam name="T">The type used to infer the default index and typename</typeparam> /// <param name="client"></param> /// <param name="ids">A list of ids as int</param> /// <param name="index">Optionally override the default inferred indexname for T</param> public static Task <IEnumerable <T> > SourceManyAsync <T>( this IElasticClient client, IEnumerable <long> ids, string index = null, CancellationToken cancellationToken = default ) where T : class => client.SourceManyAsync <T>(ids.Select(i => i.ToString(CultureInfo.InvariantCulture)), index, cancellationToken);
public ElasticSearchHelper(IElasticClient client) { this.client = client; }
protected ContentIndexService(IElasticClient client, UmbracoContext umbracoContext) : this(client, umbracoContext, SearchSettings <FromConfigSearchSettings> .Current) { }
protected Index(string name, IElasticClient elasticClient) : base(name) { // Validate parameters. ElasticClient = elasticClient ?? throw new ArgumentNullException(nameof(elasticClient)); }
public ElasticReindexer(IElasticClient client, ILogger logger = null) { _client = client; _logger = logger ?? NullLogger.Instance; }
public Handler(IElasticClient elasticClient) { _elasticClient = elasticClient; }
/// <summary> /// Initializes a new instance of the <see cref="ElasticsearchStatus"/> class. /// </summary> public ElasticsearchStatus(IElasticClient client) { _client = client; }
public static Task <DeleteSnapshotResponse> DeleteSnapshotAsync(this IElasticClient client, IDeleteSnapshotRequest request, CancellationToken ct = default ) => client.Snapshot.DeleteAsync(request, ct);
internal ElasticsearchDataProvider(IElasticClient client) { _client = new Lazy <IElasticClient>(() => client); }
/// <summary> /// SourceMany allows you to get a list of T documents out of Elasticsearch, internally it calls into MultiGet() /// <para> /// Multi GET API allows to get multiple documents based on an index, type (optional) and id (and possibly routing). /// The response includes a docs array with all the fetched documents, each element similar in structure to a document /// provided by the get API. /// </para> /// <para> </para> /// >http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-multi-get.html /// </summary> /// <typeparam name="T">The type used to infer the default index and typename</typeparam> /// <param name="client"></param> /// <param name="ids">A list of ids as int</param> /// <param name="index">Optionally override the default inferred indexname for T</param> public static IEnumerable <T> SourceMany <T>(this IElasticClient client, IEnumerable <long> ids, string index = null) where T : class => client.SourceMany <T>(ids.Select(i => i.ToString(CultureInfo.InvariantCulture)), index);
public ProductService(IElasticClient es) { _elasticClient = es; }
public PropertyNames(IndexingCluster cluster) : base(cluster) { _client = cluster.Client(); }
public CategoryEntities(IElasticClient elasticClient) { _elasticClient = elasticClient; }