- Notifications
You must be signed in to change notification settings - Fork 25.6k
Add template parameters to Search Applications #95674
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
Add template parameters to Search Applications #95674
Conversation
…ate as a separate field
…emplate parameters
| api project(':modules:lang-mustache') | ||
| | ||
| // JSON Schema dependencies | ||
| implementation "org.apache.commons:commons-lang3:${versions.commons_lang3}" |
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.
Added dependencies, which were OK according to core-infra team (Slack conversation)
| params: | ||
| field_name: field1 | ||
| field_value: value1 | ||
| dictionary: |
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.
dictionary now allows the full JSON Schema syntax, including required parameters and limiting additionalProperties.
I think we should change the name from dictionary to param_schema. It is more descriptive and in line with using a JSON schema for validation.
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.
I like your rename suggestion 👍
| } | ||
| | ||
| addQaCheckDependencies(project) | ||
| tasks.named("dependencyLicenses").configure { |
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.
Licenses for external dependencies needed to be added and some tweaking done to avoid repeating licenses for Jackson.
Some ignored classes to be added to audit as well, already done in other ES modules.
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.
Licenses were duplicated where possible from the codebase, or retrieved in the case of json-schema-validator to ensure the license check is passed.
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.
This looks great @carlosdelest , thank you! I have a few comments and questions mostly surrounding tests. Great work 💯
...a/rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/20_search_application_put.yml Show resolved Hide resolved
...a/rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/20_search_application_put.yml Show resolved Hide resolved
...a/rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/20_search_application_put.yml Show resolved Hide resolved
...a/rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/20_search_application_put.yml Show resolved Hide resolved
| params: | ||
| field_name: field1 | ||
| field_value: value1 | ||
| dictionary: |
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.
I like your rename suggestion 👍
...est/src/yamlRestTest/resources/rest-api-spec/test/entsearch/55_search_application_search.yml Show resolved Hide resolved
| name: my-test-analytics-collection | ||
| ignore: 404 | ||
| | ||
| - do: |
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.
Thanks for taking care of this!
...arch/src/main/java/org/elasticsearch/xpack/application/search/SearchApplicationTemplate.java Show resolved Hide resolved
| public SearchSourceBuilder renderQuery(SearchApplication searchApplication, Map<String, Object> templateParams) throws IOException, | ||
| ValidationException { |
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.
Nitpick:
| public SearchSourceBuilder renderQuery(SearchApplication searchApplication, Map<String, Object> templateParams) throws IOException, | |
| ValidationException { | |
| public SearchSourceBuilder renderQuery(SearchApplication searchApplication, Map<String, Object> templateParams) | |
| throws IOException, ValidationException { |
# Conflicts: # x-pack/plugin/ent-search/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/60_behavioral_analytics_list.yml
| Hi @carlosdelest, I've created a changelog YAML for you. |
…hema-validation' into carlosdelest/add-params-schema-validation
| Pinging @elastic/enterprise-search (Team:Enterprise Search) |
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.
Nice work @carlosdelest 🙌
| Pinging @elastic/ent-search-eng (Team:Enterprise Search) |
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.
LGTM to unblock
…ms-schema-validation # Conflicts: # x-pack/plugin/ent-search/build.gradle
Original PR carlosdelest#2
Continued work from kderusso#4
JSON Schema can be stored as part of the template for a Search Application:
PUT _application/search_application/<name>dictionary is a JSON Schema used to validate parameters in the _search endpoint in the future.
The dictionary content must be a valid JSON Schema.
Demo script: