@patrick - spent time looking into this, and what I have concluded:
- I currently use a JSON Data Type, so I’m outputting JSON, rather than building the query with inputs or query parameters.
- If I use you propsed method, I would infact be using inputs - and constructing the $POST in a similar structure to the JSON output e.g as highlighted here by @George:
This is an interesting implementation.
Two issues I think I’ll come across I’d appreciate your input, and a potential bug I might have identified:
- The full JSON, has each section starting with the same object which is
{
"bool": {
So if I put together two queries in the same JSON output (noting I can have 29+ queries in the same output to ES API:
{
"bool": {
"should": [
{
"bool": {
"must": [
{
"match_phrase": {
"primary.job.title.name": {
"query": "engineer"
}
}
}
]
}
}
]
}
},
{
"bool": {
"should": [
{
"bool": {
"must": [
{
"match_phrase": {
"gender": {
"query": "male"
}
}
}
]
}
}
]
}
}
]
}
},
So, this poses a potential issue, I’d then have to name each input starting with bool as the starting object. This I imagine, is not a possible implementation due to conflicts?
- I still end up with the same problem of empty values, or in this case, empty JSON sections being sent through the API to ElasticSearch. IF, a form input is empty will the JSON output of that input still be sent via the SC Form and thus through to the API? Or will nothing be sent (and thus potentially solving my problem?).
I don’t have the option to hide / disable the inputs as a way of not passing the data through, as all fields need to remain active and useable.
I’d really appreciate some suggestions here - I’m so close to a full ElasticSearch implementation querying over 400 million documents in our dataset.
Potential bug:
I implemented the same naming structure as you propsed, and also the one George used in this pos here.
When I go to global on the SC side to pull in the inputs, the input with this naming setup does not pull through at all, not even incorrectly - it just doesn’t recognize it.