Skip to content

Commit 3f819cd

Browse files
Add support for pinned query (#7576) (#7577)
* Generate pinned query * Add tests Co-authored-by: Steve Gordon <[email protected]>
1 parent e4edee0 commit 3f819cd

File tree

6 files changed

+572
-0
lines changed

6 files changed

+572
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
#nullable restore
19+
20+
using Elastic.Clients.Elasticsearch.Fluent;
21+
using Elastic.Clients.Elasticsearch.Serialization;
22+
using System;
23+
using System.Collections.Generic;
24+
using System.Linq.Expressions;
25+
using System.Text.Json;
26+
using System.Text.Json.Serialization;
27+
28+
namespace Elastic.Clients.Elasticsearch.QueryDsl;
29+
30+
public sealed partial class PinnedDoc
31+
{
32+
[JsonInclude, JsonPropertyName("_id")]
33+
public Elastic.Clients.Elasticsearch.Id Id { get; set; }
34+
[JsonInclude, JsonPropertyName("_index")]
35+
public Elastic.Clients.Elasticsearch.IndexName Index { get; set; }
36+
}
37+
38+
public sealed partial class PinnedDocDescriptor : SerializableDescriptor<PinnedDocDescriptor>
39+
{
40+
internal PinnedDocDescriptor(Action<PinnedDocDescriptor> configure) => configure.Invoke(this);
41+
42+
public PinnedDocDescriptor() : base()
43+
{
44+
}
45+
46+
private Elastic.Clients.Elasticsearch.Id IdValue { get; set; }
47+
private Elastic.Clients.Elasticsearch.IndexName IndexValue { get; set; }
48+
49+
public PinnedDocDescriptor Id(Elastic.Clients.Elasticsearch.Id id)
50+
{
51+
IdValue = id;
52+
return Self;
53+
}
54+
55+
public PinnedDocDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index)
56+
{
57+
IndexValue = index;
58+
return Self;
59+
}
60+
61+
protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
62+
{
63+
writer.WriteStartObject();
64+
writer.WritePropertyName("_id");
65+
JsonSerializer.Serialize(writer, IdValue, options);
66+
writer.WritePropertyName("_index");
67+
JsonSerializer.Serialize(writer, IndexValue, options);
68+
writer.WriteEndObject();
69+
}
70+
}

0 commit comments

Comments
 (0)