TermFilter document (Data API 23.2)

Document representing a term filter. A term filter allows you to restrict a search result to hits that match (exactly) one of the values configured for the filter. A term filter is useful for general restrictions that can be shared between searches. Use term filters whenever the criteria you filter on is a shared property of multiple searches (for example, like filtering by an order status). Use term filters for fields that have a discrete and small set of values only. Example: (id="my_id")
    query: {
        filtered_query: {
            query: { match_all_query: {} },
            filter: {
                term_filter: {
                    field: "id",
                    operator: "is",
                    values: ["my_id"]
                }
            }
        }
    }
 
Example: (id IN ("my_id","other_id"))
    query: {
        filtered_query: {
            query: { match_all_query: {} },
            filter: {
                term_filter: {
                    field: "id",
                    operator: "one_of",
                    values: ["my_id","other_id"]
                }
            }
        }
    }
 
Example: (description=NULL)
    query: {
        filtered_query: {
            query: { match_all_query: {} },
            filter: {
                term_filter: {
                    field: "description",
                    operator: "is_null"
                }
            }
        }
    }
 
Property Type Constraints Description
field String mandatory=true, nullable=false The filter field.
operator Enum {is, one_of, is_null, is_not_null, less, greater, not_in, neq} mandatory=true, nullable=false The operator to compare the field's values with the given ones.
values [Object]   The filter values.
X OCAPI versions 15.x and 16.x will be retired on March 31, 2021. For dates and more information, see the OCAPI versioning and deprecation policy and this Knowledge Article.
Notifications pending to read 9