Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 06-05-2023 01:17 PM
I am trying to roll my own search_after pagination query by saving the last sort values to a db and then retrieving them on the next time I run the query. Thing is if there are no sort values from the db this means this is a new query and I skip the search_after clause in my query. If I do retrieve a set of sort values from the db then I need to plug them into the query. I am having trouble with the EL statement. This is what I have:
{
"query": {
"bool": {
"must": [
{"term": {"key1": "value1"}}
],
"must_not": [
{"exists": {"key2": "value2"}}
],
"filter": [
{"range": {"@timestamp": {"lte": "now-1w"}}}
]
}
}
${search_after:isEmpty():not():ifElse(', \"search_after\": "${search_after}"', '')},
"sort": [
{"@timestamp": "asc"},
{"value3": "asc"}
]
}
The ${search_after} variable defined as '[ts int milliseconds, "a key value string"]' Including the sq brackets.
The error I am receiving is:
Unknown key for a VALUE_STRING in search_after line 15 col 20 type parsing exception
Does anyone know how to write the variable correctly?
Created 06-06-2023 11:43 AM
I solved my problem. The solution is to not wrap the variable with double quotes.
${search_after:isEmpty():not():ifElse(', \"search_after\": ${search_after}', '')},
Created 06-05-2023 02:26 PM
@Phil_I_AM Welcome to the Cloudera Community!
To help you get the best possible solution, I have tagged our NiFi experts @SAMSAL and @MattWho who may be able to assist you further.
Please keep us updated on your post, and we hope you find a satisfactory solution to your query.
Regards,
Diana Torres,Created 06-06-2023 11:43 AM
I solved my problem. The solution is to not wrap the variable with double quotes.
${search_after:isEmpty():not():ifElse(', \"search_after\": ${search_after}', '')},