Skip to content

Commit b5b89ab

Browse files
lcawlpquentin
andauthored
Add search_application.render_query (#3401)
* Add search_application.render_query * Add doc_id * Fix request body --------- Co-authored-by: Quentin Pradet <[email protected]>
1 parent 97867a6 commit b5b89ab

10 files changed

+258
-11
lines changed

docs/overlays/elasticsearch-openapi-overlays.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,4 +391,21 @@ actions:
391391
application/json:
392392
examples:
393393
indicesLegacyPutTemplateRequestExample1:
394-
$ref: "../../specification/indices/put_template/indicesPutTemplateRequestExample1.yaml"
394+
$ref: "../../specification/indices/put_template/indicesPutTemplateRequestExample1.yaml"
395+
## Examples for search applications
396+
- target: "$.paths['/_application/search_application/{name}/_render_query']['post']"
397+
description: "Add examples for render search application query operation"
398+
update:
399+
requestBody:
400+
content:
401+
application/json:
402+
examples:
403+
renderSearchApplicationQueryRequestExample1:
404+
$ref: "../../specification/search_application/render_query/SearchApplicationsRenderQueryRequestExample1.yaml"
405+
responses:
406+
200:
407+
content:
408+
application/json:
409+
examples:
410+
renderSearchApplicationQueryResponseExample1:
411+
$ref: "../../specification/search_application/render_query/SearchApplicationsRenderQueryResponseExample1.yaml"

output/openapi/elasticsearch-openapi.json

Lines changed: 53 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/schema/schema.json

Lines changed: 80 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/schema/validation-errors.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -623,12 +623,6 @@
623623
],
624624
"response": []
625625
},
626-
"search_application.render_query": {
627-
"request": [
628-
"Missing request & response"
629-
],
630-
"response": []
631-
},
632626
"search_mvt": {
633627
"request": [
634628
"Request: query parameter 'grid_agg' does not exist in the json spec",

output/typescript/types.ts

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/_doc_ids/table.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ search-aggregations-metrics-valuecount-aggregation,https://www.elastic.co/guide/
541541
search-aggregations-metrics-weight-avg-aggregation,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-aggregations-metrics-weight-avg-aggregation.html
542542
search-aggregations-bucket-variablewidthhistogram-aggregation,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-aggregations-bucket-variablewidthhistogram-aggregation.html
543543
search-analyzer,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-analyzer.html
544+
search-render-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-application-render-query.html
544545
search-count,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-count.html
545546
search-explain,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-explain.html
546547
search-field-caps,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-field-caps.html
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
import { Dictionary } from '@spec_utils/Dictionary'
20+
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
21+
import { RequestBase } from '@_types/Base'
22+
import { Name } from '@_types/common'
23+
24+
/**
25+
* Render a search application query.
26+
* Generate an Elasticsearch query using the specified query parameters and the search template associated with the search application or a default template if none is specified.
27+
* If a parameter used in the search template is not specified in `params`, the parameter's default value will be used.
28+
* The API returns the specific Elasticsearch query that would be generated and run by calling the search application search API.
29+
*
30+
* You must have `read` privileges on the backing alias of the search application.
31+
* @rest_spec_name search_application.render_query
32+
* @availability stack since=8.9.0 stability=experimental visibility=public
33+
* @doc_id search-render-query
34+
*/
35+
export interface Request extends RequestBase {
36+
path_parts: {
37+
/**
38+
* The name of the search application to render teh query for.
39+
*/
40+
name: Name
41+
}
42+
/**
43+
* Contains parameters for a search application.
44+
*/
45+
body: {
46+
params?: Dictionary<string, UserDefinedValue>
47+
}
48+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# summary:
2+
# method_request: POST _application/search_application/my-app/_render_query
3+
description: Run `POST _application/search_application/my-app/_render_query` to generate a query for a search application called `my-app` that uses the search template.
4+
# type: request
5+
value:
6+
params:
7+
query_string: my first query
8+
text_fields:
9+
- name: title
10+
boost: 5
11+
- name: description
12+
boost: 1
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
export class Response {
21+
body: {}
22+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# summary: ''
2+
description: A successful response for generating a query for a search application. The `from`, `size`, and `explain` parameters were not specified in the request, so the default values specified in the search template are used.
3+
# type: response
4+
# response_code: 200
5+
value:
6+
from: 0
7+
size: 10
8+
query:
9+
multi_match:
10+
query: my first query
11+
fields:
12+
- 'description^1.0'
13+
- 'title^5.0'
14+
explain: false

0 commit comments

Comments
 (0)