コード例 #1
0
ファイル: IdsInference.doc.cs プロジェクト: lukapor/NEST
        /** # Ids
         *
         * Several places in the elasticsearch API expect an Id object to be passed. This is a special box type that you can implicitly convert to and from many value types.
         */

        /** Methods that take an Id can be passed longs, ints, strings & Guids and they will implicitly converted to Ids */
        [U] public void CanImplicitlyConvertToId()
        {
            Nest.Id idFromInt    = 1;
            Nest.Id idFromLong   = 2L;
            Nest.Id idFromString = "hello-world";
            Nest.Id idFromGuid   = new Guid("D70BD3CF-4E38-46F3-91CA-FCBEF29B148E");

            Expect(1).WhenSerializing(idFromInt);
            Expect(2).WhenSerializing(idFromLong);
            Expect("hello-world").WhenSerializing(idFromString);
            Expect("d70bd3cf-4e38-46f3-91ca-fcbef29b148e").WhenSerializing(idFromGuid);
        }
コード例 #2
0
 /// <inheritdoc/>
 public IDeletePipelineResponse DeletePipeline(Id id, Func <DeletePipelineDescriptor, IDeletePipelineRequest> selector = null) =>
 this.DeletePipeline(selector.InvokeOrDefault(new DeletePipelineDescriptor(id)));
コード例 #3
0
 /// <inheritdoc />
 public Task <IForecastJobResponse> ForecastJobAsync(Id jobId, Func <ForecastJobDescriptor, IForecastJobRequest> selector = null,
                                                     CancellationToken cancellationToken = default(CancellationToken)
                                                     ) =>
 ForecastJobAsync(selector.InvokeOrDefault(new ForecastJobDescriptor(jobId)), cancellationToken);
 ///<summary>/_slm/policy/{policy_id}/_execute</summary>
 ///<param name = "policyId">this parameter is required</param>
 public ExecuteSnapshotLifecycleDescriptor(Id policyId) : base(r => r.Required("policy_id", policyId))
 {
 }
コード例 #5
0
 /// <inheritdoc />
 public Task <DeactivateWatchResponse> DeactivateWatchAsync(
     Id id,
     Func <DeactivateWatchDescriptor, IDeactivateWatchRequest> selector = null,
     CancellationToken ct = default
     ) => DeactivateWatchAsync(selector.InvokeOrDefault(new DeactivateWatchDescriptor(id)), ct);
コード例 #6
0
 /// <summary>
 /// Manually set the id for the newly created object
 /// </summary>
 public TDescriptor Id(Id id) => Assign(id, (a, v) => a.Id = v);
コード例 #7
0
 ///<summary>Comma separated list of pipeline ids. Wildcards supported</summary>
 public GetPipelineDescriptor Id(Id id) => Assign(id, (a, v) => a.RouteValues.Optional("id", v));
コード例 #8
0
 ///<summary>/_ingest/pipeline/{id}/_simulate</summary>
 ///<param name = "id">Optional, accepts null</param>
 public SimulatePipelineDescriptor(Id id) : base(r => r.Optional("id", id))
 {
 }
コード例 #9
0
 private string ResolveId(Id id, IConnectionSettingsValues nestSettings) =>
 id.Document != null?nestSettings.Inferrer.Id(id.Document) : id.StringOrLongValue;
コード例 #10
0
 /// <inheritdoc />
 public Task <IGetScriptResponse> GetScriptAsync(Id id, Func <GetScriptDescriptor, IGetScriptRequest> selector = null,
                                                 CancellationToken cancellationToken = default(CancellationToken)
                                                 ) =>
 GetScriptAsync(selector.InvokeOrDefault(new GetScriptDescriptor(id)), cancellationToken);
コード例 #11
0
 /// <inheritdoc />
 public IGetScriptResponse GetScript(Id id, Func <GetScriptDescriptor, IGetScriptRequest> selector = null) =>
 GetScript(selector.InvokeOrDefault(new GetScriptDescriptor(id)));
コード例 #12
0
 ///<summary>/_rollup/job/{id}</summary>
 ///<param name = "id">Optional, accepts null</param>
 public GetRollupJobRequest(Id id) : base(r => r.Optional("id", id))
 {
 }
コード例 #13
0
 ///<summary>/_rollup/job/{id}</summary>
 ///<param name = "id">this parameter is required</param>
 public DeleteRollupJobRequest(Id id) : base(r => r.Required("id", id))
 {
 }
コード例 #14
0
 ///<summary>/_rollup/data/{id}</summary>
 ///<param name = "id">Optional, accepts null</param>
 public GetRollupCapabilitiesRequest(Id id) : base(r => r.Optional("id", id))
 {
 }
コード例 #15
0
 /// <inheritdoc />
 public CreateRollupJobResponse CreateRollupJob <T>(Id id, Func <CreateRollupJobDescriptor <T>, ICreateRollupJobRequest> selector)
     where T : class => CreateRollupJob(selector.InvokeOrDefault(new CreateRollupJobDescriptor <T>(id)));
コード例 #16
0
 public MultiTermVectorOperationDescriptor <T> Id(Id id) => Assign(a => a.Id = id);
コード例 #17
0
 public MultiTermVectorOperation(Id id)
 {
     this.Id    = id;
     this.Index = typeof(T);
     this.Type  = typeof(T);
 }
コード例 #18
0
 public IDeleteSearchTemplateResponse DeleteSearchTemplate(Id id, Func <DeleteSearchTemplateDescriptor, IDeleteSearchTemplateRequest> selector = null) =>
 this.DeleteSearchTemplate(selector.InvokeOrDefault(new DeleteSearchTemplateDescriptor(id)));
コード例 #19
0
 ///<summary>/_ingest/pipeline/{id}</summary>
 ///<param name = "id">Optional, accepts null</param>
 public GetPipelineDescriptor(Id id) : base(r => r.Optional("id", id))
 {
 }
コード例 #20
0
 public Task <IDeleteSearchTemplateResponse> DeleteSearchTemplateAsync(Id id, Func <DeleteSearchTemplateDescriptor, IDeleteSearchTemplateRequest> selector = null, CancellationToken cancellationToken = default(CancellationToken)) =>
 this.DeleteSearchTemplateAsync(selector.InvokeOrDefault(new DeleteSearchTemplateDescriptor(id)), cancellationToken);
コード例 #21
0
 ///<summary>/_ingest/pipeline/{id}</summary>
 ///<param name = "id">this parameter is required</param>
 public PutPipelineDescriptor(Id id) : base(r => r.Required("id", id))
 {
 }
コード例 #22
0
 /// <inheritdoc cref="IPhraseSuggestCollateQuery.Id" />
 public PhraseSuggestCollateQueryDescriptor Id(Id id) => Assign(id, (a, v) => a.Id = v);
コード例 #23
0
 /// <inheritdoc />
 public DeactivateWatchResponse DeactivateWatch(Id id, Func <DeactivateWatchDescriptor, IDeactivateWatchRequest> selector = null) =>
 DeactivateWatch(selector.InvokeOrDefault(new DeactivateWatchDescriptor(id)));
コード例 #24
0
 public static JoinField Link(RelationName child, Id parentId) => new Child(child, parentId);
コード例 #25
0
 public ParentIdQueryDescriptor <T> Id(Id id) => Assign(id, (a, v) => a.Id = v);
コード例 #26
0
 public static JoinField Link <TChild, TParentDocument>(TParentDocument parent) where TParentDocument : class =>
 new Child(typeof(TChild), Id.From <TParentDocument>(parent));
コード例 #27
0
 /// <inheritdoc />
 public IForecastJobResponse ForecastJob(Id jobId, Func <ForecastJobDescriptor, IForecastJobRequest> selector = null) =>
 ForecastJob(selector.InvokeOrDefault(new ForecastJobDescriptor(jobId)));
コード例 #28
0
 public static JoinField Link <TChild>(Id parentId) => new Child(typeof(TChild), parentId);
コード例 #29
0
 public Child(RelationName name, Id parent)
 {
     Name   = name;
     Parent = parent;
 }
コード例 #30
0
 /// <inheritdoc />
 public ActivateWatchResponse ActivateWatch(Id id, Func <ActivateWatchDescriptor, IActivateWatchRequest> selector = null) =>
 ActivateWatch(selector.InvokeOrDefault(new ActivateWatchDescriptor(id)));