How to create a "NOT BETWEEN" range filter?


#1

I tried filtering a set of documents where a fields value is not between 2 values.
Is this possible? I guess it had to be a negated range filter but couldn’t find any hints about this.


#2

Hey Stefan,

You could try making use of a ! operator for the value to filter by. If that still doesn’t work, please post an example of the request being made in this thread.


#3

Hi, thanks for your quick reply.
Unfortunately it isn’t working using the ! operator.

Here is my document type (stripped to the essential basics):

[
  {
    "id": "5abb6041a1f2531bf43d7a39",
    "name": "entity:node",
    "slug": "entity-node",
    "engine_id": "5ab0d4a914cc8a29f8ddcda5",
    "updated_at": "2018-03-28T09:28:48Z",
    "document_count": 7,
    "field_mapping": {
      "external_id": "enum",
      "updated_at": "date",
      "index_id": "string",
      "s_title": "text",
      "s_created": "date",
      "s_status": "enum",
      "s_body": "text",
      "s_field_article_score": "integer",
    }
  }
]

And here the request i make:

  "auth_token": "***",
  "q": "",
  "fetch_fields": {
    "entity-node": [
      "external_id",
      "s_field_article_score"
    ]
  },
  "filters": {
    "entity-node": {
      "s_field_article_score": {
        "type": "range",
        "from": "!0",
        "to": "!4"
      }
    }
  }
}

I expected to see 3 results (“s_field_article_score”: -10, -3, 10).