-
Notifications
You must be signed in to change notification settings - Fork 102
Add search_application.render_query #3401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import { Dictionary } from '@spec_utils/Dictionary' | ||
import { UserDefinedValue } from '@spec_utils/UserDefinedValue' | ||
import { RequestBase } from '@_types/Base' | ||
import { Name } from '@_types/common' | ||
|
||
/** | ||
* Render a search application query. | ||
* 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. | ||
* If a parameter used in the search template is not specified in `params`, the parameter's default value will be used. | ||
* The API returns the specific Elasticsearch query that would be generated and run by calling the search application search API. | ||
* | ||
* You must have `read` privileges on the backing alias of the search application. | ||
* @rest_spec_name search_application.render_query | ||
* @availability stack since=8.9.0 stability=experimental visibility=public | ||
* @doc_id search-render-query | ||
*/ | ||
export interface Request extends RequestBase { | ||
path_parts: { | ||
/** | ||
* The name of the search application to render teh query for. | ||
*/ | ||
name: Name | ||
} | ||
/** | ||
* Contains parameters for a search application. | ||
*/ | ||
body: { | ||
params?: Dictionary<string, UserDefinedValue> | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# summary: | ||
# method_request: POST _application/search_application/my-app/_render_query | ||
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. | ||
# type: request | ||
value: | ||
params: | ||
query_string: my first query | ||
text_fields: | ||
- name: title | ||
boost: 5 | ||
- name: description | ||
boost: 1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
export class Response { | ||
body: {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Q: Do we somewhere track these cases where we only defined a request, but not a proper response? Doing it like this will suppress the compiler warning about missing request/response. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. Does this mean it's preferable to omit the response file entirely when we don't know the contents of the body? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'm also surprised that
Ideally, yes, but it breaks the OpenAPI transformation right now. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# summary: '' | ||
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. | ||
# type: response | ||
# response_code: 200 | ||
value: | ||
from: 0 | ||
size: 10 | ||
query: | ||
multi_match: | ||
query: my first query | ||
fields: | ||
- 'description^1.0' | ||
- 'title^5.0' | ||
explain: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo:
the