Skip to content

Commit b909694

Browse files
committed
Update percolate query docs to include field
Update Indices Paths Closes #2094
1 parent dd069d2 commit b909694

File tree

4 files changed

+22
-64
lines changed

4 files changed

+22
-64
lines changed

docs/client-concepts/high-level/inference/indices-paths.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ please modify the original csharp file found at the link and submit the PR with
1616
== Indices paths
1717

1818
Some APIs in Elasticsearch take one or many index name or a special `_all` marker to send the request to all the indices
19-
In nest this is encoded using `Indices`.
19+
In NEST, this is encoded using `Indices`.
2020

2121
=== Implicit Conversion
2222

docs/query-dsl/specialized/percolate/percolate-query-usage.asciidoc

Lines changed: 16 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -149,74 +149,14 @@ The required fields to percolate an existing document are:
149149

150150
* `type` of the document
151151

152+
* `field` that contains the query
153+
152154
* `id` of the document
153155

154156
* `document_type` type / mapping of the document
155157

156158
See the Elasticsearch documentation on {ref_current}/query-dsl-percolate-query.html[percolate query] for more details.
157159

158-
[source,csharp]
159-
----
160-
foreach (var index in values.Values)
161-
{
162-
this.Client.CreateIndex(index, c => c
163-
.Mappings(m => m
164-
.Map<Project>(mm => mm.AutoMap()
165-
.Properties(Seeder.ProjectProperties)
166-
)
167-
.Map<PercolatedQuery>(mm => mm.AutoMap()
168-
.Properties(Seeder.PercolatedQueryProperties)
169-
)
170-
)
171-
);
172-
173-
this.Client.Index(new PercolatedQuery
174-
{
175-
Id = PercolatorId,
176-
Query = new QueryContainer(new MatchQuery
177-
{
178-
Field = Infer.Field<Project>(f => f.LeadDeveloper.FirstName),
179-
Query = "Martijn"
180-
})
181-
}, d => d.Index(index));
182-
183-
this.Client.Index(Project.Instance);
184-
this.Client.Refresh(Nest.Indices.Index(index).And<Project>());
185-
}
186-
----
187-
188-
=== Fluent DSL Example
189-
190-
[source,csharp]
191-
----
192-
f =>
193-
f.Query(QueryFluent).Index(CallIsolatedValue).AllTypes()
194-
----
195-
196-
=== Object Initializer Syntax Example
197-
198-
[source,csharp]
199-
----
200-
new SearchRequest<PercolatedQuery>(CallIsolatedValue, Types.All)
201-
{
202-
Query = this.QueryInitializer
203-
}
204-
----
205-
206-
[source,javascript]
207-
.Example json output
208-
----
209-
{
210-
"percolate": {
211-
"type": "project",
212-
"index": "project",
213-
"id": "Durgan LLC",
214-
"document_type": "project",
215-
"field": "query"
216-
}
217-
}
218-
----
219-
220160
=== Fluent DSL Example
221161

222162
[source,csharp]
@@ -246,6 +186,20 @@ new PercolateQuery
246186
}
247187
----
248188

189+
[source,javascript]
190+
.Example json output
191+
----
192+
{
193+
"percolate": {
194+
"type": "project",
195+
"index": "project",
196+
"id": "Durgan LLC",
197+
"document_type": "project",
198+
"field": "query"
199+
}
200+
}
201+
----
202+
249203
=== Handling Responses
250204

251205
[source,csharp]

src/Tests/ClientConcepts/HighLevel/Inference/IndicesPaths.doc.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class IndicesPaths : DocumentationTestBase
1212
/**== Indices paths
1313
*
1414
* Some APIs in Elasticsearch take one or many index name or a special `_all` marker to send the request to all the indices
15-
* In nest this is encoded using `Indices`.
15+
* In NEST, this is encoded using `Indices`.
1616
*
1717
*=== Implicit Conversion
1818
* Several types implicitly convert to `Indices`

src/Tests/QueryDsl/Specialized/Percolate/PercolateQueryUsageTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ protected override void ExpectResponse(ISearchResponse<PercolatedQuery> response
136136
* The required fields to percolate an existing document are:
137137
* - `index` in which the document resides
138138
* - `type` of the document
139+
* - `field` that contains the query
139140
* - `id` of the document
140141
* - `document_type` type / mapping of the document
141142
*
@@ -161,6 +162,7 @@ protected override LazyResponses ClientUsage() => Calls(
161162

162163
public PercolateQueryExistingDocumentUsageTests(IndexingCluster i, EndpointUsage usage) : base(i, usage) { }
163164

165+
//hide
164166
protected override void IntegrationSetup(IElasticClient client, CallUniqueValues values)
165167
{
166168
foreach (var index in values.Values)
@@ -203,9 +205,11 @@ protected override void IntegrationSetup(IElasticClient client, CallUniqueValues
203205
}
204206
};
205207

208+
//hide
206209
protected override Func<SearchDescriptor<PercolatedQuery>, ISearchRequest> Fluent => f =>
207210
f.Query(QueryFluent).Index(CallIsolatedValue).AllTypes();
208211

212+
//hide
209213
protected override SearchRequest<PercolatedQuery> Initializer =>
210214
new SearchRequest<PercolatedQuery>(CallIsolatedValue, Types.All)
211215
{

0 commit comments

Comments
 (0)