Hey guys,
I have a json like this:
{"filterIds": [{
"type":"range",
"property":"creationDate",
"filter":{
"gte":1531401621486,
"lt":1531401741487
}
},
{
"type":"range",
"property":"modified",
"filter":{
"gte":1531401621486,
"lt":1531401741487
}
},
{
"type":"wildcard",
"property":"filename",
"filter":"*ssss*"
},
{
"type":"wildcard",
"property":"process",
"filter":"*ssss*"
},
{
"type":"term",
"property":"progress",
"filter":"*ssss*"
},
{
"type":"wildcard",
"property":"moduleType",
"filter":"*ssss*"
},
{
"type":"wildcard",
"property":"moduleId",
"filter":"*ssss*"
},
{
"type":"wildcard",
"property":"node",
"filter":"*ssss*"
},
{
"type":"terms",
"property":"status",
"filter":[
"Aborted",
"Failed"
]
},
{
"type":"wildcard",
"property":"queueId",
"filter":"*ssss*"
},
{
"type":"term",
"property":"priority",
"filter":"111"
},
{
"_id":"AWQmOrfhlg7OsE4l8Hnj"
}
]}
And I want add that dinamically to a query and use the Java API to query the DB, although some of these fields are parts of different parts of my query, like "should", "must", "filter". And they are dynamic which means, one or more of them might exist or not.
Is there a way for me, for example to set QueryBuilders.boolQuery().filter(QueryBuilders.wildcardQuery(JSON))
using the JSON itself? Or at least a part of it?, since is dynamic, I cannot set manually or hardcode, field by field.