Пример #1
0
 public string IndexName(IndexName index) => IndexNameResolver.Resolve(index);
Пример #2
0
 /// <summary>
 /// Manually set the index, default to the default index or the index set for the type on the connectionsettings.
 /// </summary>
 public MultiGetOperationDescriptor <T> Index(IndexName index) => Assign(index, (a, v) => a.Index = v);
Пример #3
0
 /// <inheritdoc cref="RetryIlm(Nest6.IndexName,System.Func{Nest6.RetryIlmDescriptor,Nest6.IRetryIlmRequest})" />
 public Task <IRetryIlmResponse> RetryIlmAsync(IndexName index, Func <RetryIlmDescriptor, IRetryIlmRequest> selector = null,
                                               CancellationToken cancellationToken = default(CancellationToken)
                                               ) =>
 RetryIlmAsync(selector.InvokeOrDefault(new RetryIlmDescriptor(index)), cancellationToken);
Пример #4
0
 public MoveClusterRerouteCommandDescriptor Index(IndexName index) => Assign(index, (a, v) => a.Index = v);
Пример #5
0
 /// <inheritdoc cref="ICreateFollowIndexRequest.LeaderIndex"/>
 public CreateFollowIndexDescriptor LeaderIndex(IndexName index) => Assign(index, (a, v) => a.LeaderIndex = v);
Пример #6
0
 public Task <IShrinkIndexResponse> ShrinkIndexAsync(
     IndexName source,
     IndexName target,
     Func <ShrinkIndexDescriptor, IShrinkIndexRequest> selector = null,
     CancellationToken cancellationToken = default(CancellationToken)
     ) => ShrinkIndexAsync(selector.InvokeOrDefault(new ShrinkIndexDescriptor(source, target)));
Пример #7
0
 /// <inheritdoc cref="GetRollupIndexCapabilities(IndexName, System.Func{Nest6.GetRollupIndexCapabilitiesDescriptor,Nest6.IGetRollupIndexCapabilitiesRequest})" />
 public IGetRollupIndexCapabilitiesResponse GetRollupIndexCapabilities(
     IndexName index,
     Func <GetRollupIndexCapabilitiesDescriptor, IGetRollupIndexCapabilitiesRequest> selector = null
     ) =>
 GetRollupIndexCapabilities(selector.InvokeOrDefault(new GetRollupIndexCapabilitiesDescriptor(index)));
Пример #8
0
 /// <summary>
 /// 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>
 /// >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">IEnumerable of ids as ints for the documents to fetch</param>
 /// <param name="index">Optionally override the default inferred index name for T</param>
 /// <param name="type">Optionally overiide the default inferred typename for T</param>
 public static Task <IEnumerable <IMultiGetHit <T> > > GetManyAsync <T>(
     this IElasticClient client, IEnumerable <long> ids, IndexName index = null, TypeName type = null,
     CancellationToken cancellationToken = default(CancellationToken)
     )
     where T : class => client.GetManyAsync <T>(ids.Select(i => i.ToString(CultureInfo.InvariantCulture)), index, type, cancellationToken);
Пример #9
0
 /// <inheritdoc cref="PauseFollowIndex(IndexName, System.Func{Nest6.PauseFollowIndexDescriptor,Nest6.IPauseFollowIndexRequest})" />
 public IPauseFollowIndexResponse PauseFollowIndex(IndexName index, Func <PauseFollowIndexDescriptor, IPauseFollowIndexRequest> selector = null) =>
 PauseFollowIndex(selector.InvokeOrDefault(new PauseFollowIndexDescriptor(index)));
Пример #10
0
        /// <summary>
        /// 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>
        /// >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">IEnumerable of ids as string for the documents to fetch</param>
        /// <param name="index">Optionally override the default inferred index name for T</param>
        /// <param name="type">Optionally overiide the default inferred typename for T</param>
        public static IEnumerable <IMultiGetHit <T> > GetMany <T>(this IElasticClient client, IEnumerable <string> ids, IndexName index = null,
                                                                  TypeName type = null
                                                                  )
            where T : class
        {
            var result = client.MultiGet(s => s
                                         .RequestConfiguration(r => r.ThrowExceptions())
                                         .GetMany <T>(ids)
                                         .Index(index)
                                         .Type(type)
                                         );

            return(result.GetMany <T>(ids));
        }
Пример #11
0
 /// <summary>
 /// 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>
 /// >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">IEnumerable of ids as ints for the documents to fetch</param>
 /// <param name="index">Optionally override the default inferred index name for T</param>
 /// <param name="type">Optionally overiide the default inferred typename for T</param>
 public static IEnumerable <IMultiGetHit <T> > GetMany <T>(this IElasticClient client, IEnumerable <long> ids, IndexName index = null,
                                                           TypeName type = null
                                                           )
     where T : class => client.GetMany <T>(ids.Select(i => i.ToString(CultureInfo.InvariantCulture)), index, type);
Пример #12
0
 /// <inheritdoc cref="MoveToStep(Nest6.IndexName,System.Func{Nest6.MoveToStepDescriptor,Nest6.IMoveToStepRequest})" />
 public Task <IMoveToStepResponse> MoveToStepAsync(IndexName index, Func <MoveToStepDescriptor, IMoveToStepRequest> selector = null,
                                                   CancellationToken cancellationToken = default(CancellationToken)
                                                   ) =>
 MoveToStepAsync(selector.InvokeOrDefault(new MoveToStepDescriptor(index)), cancellationToken);
Пример #13
0
 /// <inheritdoc cref="MoveToStep(Nest6.IndexName,System.Func{Nest6.MoveToStepDescriptor,Nest6.IMoveToStepRequest})" />
 public IMoveToStepResponse MoveToStep(IndexName index, Func <MoveToStepDescriptor, IMoveToStepRequest> selector = null) =>
 MoveToStep(selector.InvokeOrDefault(new MoveToStepDescriptor(index)));
Пример #14
0
 public TDescriptor Index(IndexName index) => Assign(index, (a, v) => a.Index = v);
Пример #15
0
 /// <inheritdoc cref="CreateFollowIndex(IndexName, System.Func{Nest6.CreateFollowIndexDescriptor,Nest6.ICreateFollowIndexRequest})" />
 public ICreateFollowIndexResponse CreateFollowIndex(IndexName index, Func <CreateFollowIndexDescriptor, ICreateFollowIndexRequest> selector) =>
 CreateFollowIndex(selector.InvokeOrDefault(new CreateFollowIndexDescriptor(index)));
Пример #16
0
 /// <inheritdoc cref="PauseFollowIndex(IndexName, System.Func{Nest6.PauseFollowIndexDescriptor,Nest6.IPauseFollowIndexRequest})" />
 public Task <IPauseFollowIndexResponse> PauseFollowIndexAsync(
     IndexName index,
     Func <PauseFollowIndexDescriptor, IPauseFollowIndexRequest> selector = null,
     CancellationToken cancellationToken = default
     ) =>
 PauseFollowIndexAsync(selector.InvokeOrDefault(new PauseFollowIndexDescriptor(index)), cancellationToken);
Пример #17
0
 /// <inheritdoc cref="CreateFollowIndex(IndexName, System.Func{Nest6.CreateFollowIndexDescriptor,Nest6.ICreateFollowIndexRequest})" />
 public Task <ICreateFollowIndexResponse> CreateFollowIndexAsync(IndexName index, Func <CreateFollowIndexDescriptor, ICreateFollowIndexRequest> selector,
                                                                 CancellationToken cancellationToken = default
                                                                 ) =>
 CreateFollowIndexAsync(selector.InvokeOrDefault(new CreateFollowIndexDescriptor(index)), cancellationToken);
Пример #18
0
        /// <summary>
        /// Shortcut into the Bulk call that deletes the specified objects
        /// <para> </para>
        /// http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-bulk.html
        /// </summary>
        /// <param name="client"></param>
        /// <typeparam name="T">The type used to infer the default index and typename</typeparam>
        /// <param name="objects">List of objects to delete</param>
        /// <param name="index">Override the inferred indexname for T</param>
        /// <param name="type">Override the inferred typename for T</param>
        public static IBulkResponse DeleteMany <T>(this IElasticClient client, IEnumerable <T> @objects, IndexName index = null, TypeName type = null)
            where T : class
        {
            var bulkRequest = CreateDeleteBulkRequest(objects, index, type);

            return(client.Bulk(bulkRequest));
        }
Пример #19
0
 internal static bool IsNullOrEmpty(this IndexName value) => value == null || value.GetHashCode() == 0;
Пример #20
0
        /// <summary>
        /// Shortcut into the Bulk call that deletes the specified objects
        /// <para> </para>
        /// http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-bulk.html
        /// </summary>
        /// <param name="client"></param>
        /// <typeparam name="T">The type used to infer the default index and typename</typeparam>
        /// <param name="objects">List of objects to delete</param>
        /// <param name="index">Override the inferred indexname for T</param>
        /// <param name="type">Override the inferred typename for T</param>
        public static Task <IBulkResponse> DeleteManyAsync <T>(this IElasticClient client, IEnumerable <T> objects, IndexName index = null,
                                                               TypeName type = null, CancellationToken cancellationToken = default(CancellationToken)
                                                               )
            where T : class
        {
            var bulkRequest = CreateDeleteBulkRequest(objects, index, type);

            return(client.BulkAsync(bulkRequest, cancellationToken));
        }
Пример #21
0
 /// <inheritdoc cref="GetRollupIndexCapabilities(IndexName, System.Func{Nest6.GetRollupIndexCapabilitiesDescriptor,Nest6.IGetRollupIndexCapabilitiesRequest})" />
 public Task <IGetRollupIndexCapabilitiesResponse> GetRollupIndexCapabilitiesAsync(
     IndexName index,
     Func <GetRollupIndexCapabilitiesDescriptor, IGetRollupIndexCapabilitiesRequest> selector = null,
     CancellationToken cancellationToken = default
     ) =>
 GetRollupIndexCapabilitiesAsync(selector.InvokeOrDefault(new GetRollupIndexCapabilitiesDescriptor(index)), cancellationToken);
Пример #22
0
        private static BulkRequest CreateDeleteBulkRequest <T>(IEnumerable <T> objects, IndexName index, TypeName type) where T : class
        {
            @objects.ThrowIfEmpty(nameof(objects));
            var bulkRequest = new BulkRequest(index, type);
            var deletes     = @objects
                              .Select(o => new BulkDeleteOperation <T>(o))
                              .Cast <IBulkOperation>()
                              .ToList();

            bulkRequest.Operations = deletes;
            return(bulkRequest);
        }
Пример #23
0
 /// <inheritdoc />
 public ISplitIndexResponse SplitIndex(IndexName source, IndexName target, Func <SplitIndexDescriptor, ISplitIndexRequest> selector = null) =>
 SplitIndex(selector.InvokeOrDefault(new SplitIndexDescriptor(source, target)));
Пример #24
0
 /// <inheritdoc cref="RetryIlm(Nest6.IndexName,System.Func{Nest6.RetryIlmDescriptor,Nest6.IRetryIlmRequest})" />
 public IRetryIlmResponse RetryIlm(IndexName index, Func <RetryIlmDescriptor, IRetryIlmRequest> selector = null) =>
 RetryIlm(selector.InvokeOrDefault(new RetryIlmDescriptor(index)));
Пример #25
0
 public AliasRemoveIndexDescriptor Index(IndexName index)
 {
     Self.RemoveIndex.Index = index;
     return(this);
 }
Пример #26
0
 public AnalyzeRequest(IndexName indices, string textToAnalyze)
     : this(indices) => Text = new[] { textToAnalyze };