> For the complete documentation index, see [llms.txt](https://spaceone-dev.gitbook.io/api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://spaceone-dev.gitbook.io/api-reference/common-v1/search-query/filter-options.md).

# Filter Operators

{% tabs %}
{% tab title="Default Filter options" %}
***Default Operators***

| NO | KEY              | TYPE   | DESC                     | SYMBOLIC SQL                 |
| -- | ---------------- | ------ | ------------------------ | ---------------------------- |
| 1  | lt               | string | less than                | <                            |
| 2  | lte              | string | less than or equal to    | ≤                            |
| 3  | gt               | string | greater than             | >                            |
| 4  | gte              | string | greater than or equal to | ≥                            |
| 5  | eq               | string | equal to                 | =                            |
| 6  | not              | string |                          | !=                           |
| 7  | exists           | string | exists                   | EXISTS                       |
| 8  | contain          | string | contains                 | %str%                        |
| 9  | not\_contain     | string | not contains             | NOT LIKE '%str%';            |
| 10 | in               | string | include                  | IN ("a","b"**,**"c")         |
| 11 | not\_in          | string | not include              | NOT IN ("a", "b", "c")       |
| 12 | not\_contain\_in | string | no contain in            | NOT IN ('%A%', '%B%', '%C%') |
| 13 | match            | string |                          | WHERE T.A='a' AND T.B='b'    |

{% hint style="info" %}
**FILTER REGULATIONS:**&#x20;

* **Match**
  * Search field with k (key) **MUST** be **list of dict**
  * Only offers **dict** type in value
  * Case-sensitive in value
  * Full-match only&#x20;
    * refers to [$elemMatch (query)](https://docs.mongodb.com/manual/reference/operator/query/elemMatch/)&#x20;
      {% endhint %}

**Sample Input**

```javascript
{
    "domain_id": "{domain_id}",
    "query": {
        "filter": [
            {
                "k": "data.disk.core",
                "v": 4,
                "o": "gte"
            },
            {
                "k": "tags.spaceone:plugin_name",
                "v": "aws-health",
                "o": "eq"
            },
            {
                "k": "data.softwares", 
                "v": { "version": "1.0.0", "name": "mysql" }, 
                "o": "match"
             }
        ]
    }
}
```

{% endtab %}

{% tab title="Custom Filter Options" %}
***Custom Operators***

| NO | KEY           | TYPE   | DESC                                     | SYMBOLIC SQL |
| -- | ------------- | ------ | ---------------------------------------- | ------------ |
| 1  | datetime\_lt  | string | date time less than                      | <            |
| 2  | datetime\_lte | string | date time less than or equal to          | ≤            |
| 3  | datetime\_gt  | string | date time greater than                   | >            |
| 4  | datetime\_gte | string | date time greater than or equal to       | ≥            |
| 5  | timediff\_lt  | string | time difference less than                | <            |
| 6  | timediff\_lte | string | time difference less than or equal to    | ≤            |
| 7  | timediff\_gt  | string | time difference greater than             | >            |
| 8  | timediff\_gte | string | time difference greater than or equal to | ≥            |

**datetime or timediff builder**

1. **With ISO8601**

   **Please refer to** [**ISO8601**](https://en.wikipedia.org/wiki/ISO_8601) **for more**

   ```javascript
   {
   	"name": "spaceone",
   	"query": {
   		"filter": [
   			{
   				"k": "created_at",
   				"v": "2020-05-06T10:49:44Z",
   				"o": "timediff_gt"
   			}
   		]
   	}
   }

   ```
2. **With operators**&#x20;

   ```javascript
   {
   	"name": "spaceone",
   	"query": {
   		"filter": [
   			{
   				"k": "created_at",
   				"v": "now + 24",
   				"o": "timediff_gt"
   			}
   		]
   	}
   }
   ```

   | Item         | CANDIDATE                | DESC                                                                                                |
   | ------------ | ------------------------ | --------------------------------------------------------------------------------------------------- |
   | **time**     | ***now, now/d, now/w***  | time values                                                                                         |
   | **operator** | ***+, -***               | operator for sum and subtraction                                                                    |
   | **deltas**   | ***24 (s, m, h, d, w)*** | <p>value to operate with <br>s: second</p><p>m: minute</p><p>h: hour</p><p>d: day</p><p>w: week</p> |

{% endtab %}
{% endtabs %}
