πInstruction Filters
All filter types that can be applied to instruction query 'filter' objects
Overview
Several of Carpool's instruction queries accept a filter object in the POST body. This is an abstraction on top of Elasticsearch and is made to help users perform powerful aggregations and searches. Below you can find all possible filters for instruction queries
Instruction Filters
Combining Filters
It is important to note that you can also combine any of the above filters within a single query. You can return results based on an AND or OR condition.
AND
Schema
"filter": {
"and": [
{
"type": "FILTER_TYPE",
...
},
{
"type": "FILTER_TYPE",
...
},
...
]
}
Example
"filter": {
"and": [
{
"type": "INSTRUCTION_ARG_EXISTS",
"path": "data.creators.address"
},
{
"type": "INSTRUCTION_ARG_NUMERIC",
"path": "data.creators.percentageShare",
"range": {
"eq": 100
}
}
]
}
OR
Schema
"filter": {
"or": [
{
"type": "FILTER_TYPE",
...
},
{
"type": "FILTER_TYPE",
...
},
...
]
}
Example
"filter": {
"or": [
{
"type": "INSTRUCTION_ARG_EXISTS",
"path": "data.creators.address"
},
{
"type": "INSTRUCTION_ARG_NUMERIC",
"path": "data.creators.percentageShare",
"range": {
"eq": 100
}
}
]
}
Negating Filters
You can also negate filters if you'd like to look for all instructions that do not match the filter criteria. To negate, simply add "negate": true
to the top level of the filter.
Example
"filter": {
"type": "INSTRUCTION_ARG_EXISTS",
"path": "data.creators.address",
"negate": true
}
Last updated