Repository navigation
[FEATURE] Add script_score to query DSL #253
Description
Activity
Related, we've been working on https://github.com/opensearch-project/opensearch-api-specification. For this client we need help for someone to pickup #233 and other generator-related work.
@quangcap Now that you're very familiar with this API, would you be able to contribute it to the spec as well? https://github.com/opensearch-project/opensearch-api-specification
Closed via #254.
@dblock Sorry for the late reply!
About #233: I tried out the ApiGenerator, and it throws a lot of errors, probably because the current parser doesn’t support OAS 3.1 yet. I’ve seen some work being done on the parser (kevindew/openapi3_parser#22), but I don’t think it’ll be ready anytime soon.
As for adding
script_scoreto the spec: Absolutely, I’d love to help out! But I believescript_scorequery is added in the spec.FWIW, I've been able to load the spec with the current openapi3_parser:
require 'open-uri' require 'openapi3_parser' openapi_url = "https://github.com/opensearch-project/opensearch-api-specification/releases/download/main-latest/opensearch-openapi.yaml" openapi_path = "opensearch-openapi.yaml" File.write(openapi_path, URI.open(openapi_url).read) unless File.exists?(openapi_path) puts "Loading #{openapi_path} (#{File.size(openapi_path)} byte(s)) ..." doc = Openapi3Parser.load_file(openapi_path) puts "Loaded #{openapi_url} with #{doc.paths.size} path(s)." doc.paths.keys.each do |key| puts key end
I've been able to load it with the current openapi3_parser. However, running
.valid?and.errors, I can print out a lot of errors.... doc = Openapi3Parser.load_file(openapi_path) puts "Loaded #{openapi_url} with #{doc.paths.size} path(s)." puts "Spec is valid: " + doc.valid?.to_s puts "Errors:" doc.errors.each do |err| puts err end
which prints:
Loading opensearch-openapi.yaml (1885141 byte(s)) ... Loaded https://github.com/opensearch-project/opensearch-api-specification/releases/download/main-latest/opensearch-openapi.yaml with 320 path(s). Spec is valid: false Errors: #/components/parameters/_global%3A%3Aquery.pretty does not resolve to a valid object #/components/parameters/_global%3A%3Aquery.human does not resolve to a valid object #/components/parameters/_global%3A%3Aquery.error_trace does not resolve to a valid object #/components/parameters/_global%3A%3Aquery.pretty does not resolve to a valid object #/components/parameters/_global%3A%3Aquery.human does not resolve to a valid object #/components/parameters/_global%3A%3Aquery.error_trace does not resolve to a valid object #/components/parameters/_global%3A%3Aquery.pretty does not resolve to a valid object #/components/parameters/_global%3A%3Aquery.human does not resolve to a valid object #/components/parameters/_global%3A%3Aquery.error_trace does not resolve to a valid object ...@quangcap Do you know whether those are legit errors? If they are, please do open an issue in https://github.com/opensearch-project/opensearch-api-specification.
Reacted by Quang (Matt) Cap
Is your feature request related to a problem?
Script Score query was added to OpenSearch 2.9 and current query DSL does not support it.
I use script score a lot in my case, so I would want to add it in current query DSL.
What solution would you like?
Add script_score to query DSL
Do you have any additional context?
OpenSearch document on script_score: https://opensearch.org/docs/latest/query-dsl/specialized/script-score/