'Using @Query to access a data object?

I have a Spring Elastic Repository function that has way too many parameters (11 parameters).

I want to be able to access members of class objects to reduce the parameter count. Is there a way to access class members via @Query? For example, I want to access members of the following class:

public class Header {
    int version;
    string timestamp;
}

and want to do a query as follows:

@Query("""
    {
        "bool":{
            "must":[
                { "match": { "header_version": {"query": "<header version substitution>"}}},
                { "match": { "header_timestamp": {"query": "<header timestamp substitution>"}}},
                { "match": { "body": {"query": "<body value>"}}}
            ]
        }
    }
""")
List<Result> findEntry(Header header, String body);

Where:

public class Result {
    int version;
    String timestamp;
    String body;
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source