Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Nest/Modules/SnapshotAndRestore/Snapshot/Snapshot.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Elasticsearch.Net;

namespace Nest
{
Expand Down Expand Up @@ -35,5 +36,8 @@ public class Snapshot

[DataMember(Name ="state")]
public string State { get; internal set; }

[DataMember(Name ="metadata")]
public IReadOnlyDictionary<string, object> Metadata { get; internal set; } = EmptyReadOnly<string, object>.Dictionary;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Runtime.Serialization;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Elasticsearch.Net.Utf8Json;

namespace Nest
Expand All @@ -18,6 +20,9 @@ public partial interface ISnapshotRequest

[DataMember(Name ="partial")]
bool? Partial { get; set; }

[DataMember(Name = "metadata")]
IDictionary<string, object> Metadata { get; set; }
}

public partial class SnapshotRequest
Expand All @@ -28,6 +33,8 @@ public partial class SnapshotRequest
public Indices Indices { get; set; }

public bool? Partial { get; set; }

public IDictionary<string, object> Metadata { get; set; }
}

public partial class SnapshotDescriptor
Expand All @@ -39,6 +46,8 @@ public partial class SnapshotDescriptor

bool? ISnapshotRequest.Partial { get; set; }

IDictionary<string, object> ISnapshotRequest.Metadata { get; set; }

public SnapshotDescriptor Index(IndexName index) => Indices(index);

public SnapshotDescriptor Index<T>() where T : class => Indices(typeof(T));
Expand All @@ -50,5 +59,10 @@ public partial class SnapshotDescriptor
public SnapshotDescriptor IncludeGlobalState(bool? includeGlobalState = true) => Assign(includeGlobalState, (a, v) => a.IncludeGlobalState = v);

public SnapshotDescriptor Partial(bool? partial = true) => Assign(partial, (a, v) => a.Partial = v);

public SnapshotDescriptor Metadata(IDictionary<string, object> metadata) => Assign(metadata, (a, v) => a.Metadata = v);

public SnapshotDescriptor Metadata(Func<FluentDictionary<string, object>, IDictionary<string, object>> selector) =>
Assign(selector, (a, v) => a.Metadata = v?.Invoke(new FluentDictionary<string, object>()));
}
}