I am using following elasticsearch query which I created using POST /_search/template/search
through Postman
{
"template": {
"query": {
"bool": {
"should": [
{
"nested": {
"path": "paymentAccounts",
"query": {
"bool": {
"should": [
{
"nested": {
"path": "accounts",
"query": {
"bool": {
"should": [
{
"wildcard": {
"accounts.person.email.keyword": "*{{smartsearchquerystring}}*"
}
},
{
"wildcard": {
"accounts.description.keyword": "*{{smartsearchquerystring}}*"
}
},
{
"wildcard": {
"accounts.tradeName.keyword": "*{{smartsearchquerystring}}*"
}
},
{
"wildcard": {
"accounts.referenceId.keyword": "*{{smartsearchquerystring}}*"
}
}
]
}
}
}
}
]
}
}
}
}
]
}
},
"from" : "{{offset}}",
"size" : "{{limit}}"
}
}
Now each time if I want to update the search template I hit the same endpoint through Postman. I want to create a method in my service such as whenever I want to update that any template just gives params to that method and create or update the template.
How can I do that using Java? or any suggestions regarding this.