[RFC] [Search Pipeline] Script request processor support non-primitive types #9200
Labels
enhancement
Enhancement or improvement to existing feature or request
Roadmap:Search
Project-wide roadmap label
Search:Relevance
Is your feature request related to a problem? Please describe.
Script request processor feature was launched in version 2.9.0 with the introduction of search pipeline. It supports all parameters in the search request body that are of primitive types (mostly boolean and int). The objective of this document is to explore the possibility of extending support to non-primitive type parameters (NPTs), mainly complex objects with internal builders (refer to the appendix for the complete list).
The objective in implementing support for these NPTs within the existing script context include:
Describe the solution you'd like
Approach One: Allowing Raw Request Parameters in JSON Format for All NPTs
Example script source:
Pros:
Cons:
Approach Two: Leverage Map Interface
Example script source:
Pros:
Cons:
Object put(String key, Object value)
is inconsisent to exist builder interface inSearchRequestBuilder
Approach Three: Combining Both Approaches?
This approach would seek to merge the benefits of the previous two methods. It could potentially provide the versatility of allowing raw JSON for building certain NPTs like
query
while still offering a more user-friendly interface for simple NPTs such assort
andtimeout
. Specific details would need to be fleshed out to determine the feasibility and the best way to balance the advantages and drawbacks of both paths.Timeout exposed in approach 2:
Query exposed in approach 1:
See the rest in Additional context
Describe alternatives you've considered
Yes, the script processor is supported by the ingest pipeline. The implementation, on the other hand, is simple: create a map context with only top-level access to the indexing document in JSON format. It does not apply to our circumstance.
Yes, all approaches are backward compatible because no
SearchSourceBuilder
internal interface exposed in the script context.Additional context
Related issues:
#6712
#7757
Example search request with all parameters in request body:
FetchSourceContext exposed in approach 2:
List indexBoosts
The text was updated successfully, but these errors were encountered: