# Apply field-level security with conditions

**URL:** <https://forum.opensearch.org/t/apply-field-level-security-with-conditions/5696>\
**Category:** Security\
**Created:** [April 21, 2021, 11:14am UTC](https://forum.opensearch.org/t/apply-field-level-security-with-conditions/5696 "2021-04-21T11:14:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![filipe](https://avatars.discourse-cdn.com/v4/letter/f/35a633/32.png) [@filipe](https://forum.opensearch.org/u/filipe)\
**Post date:** [April 21, 2021, 11:14am UTC](https://forum.opensearch.org/t/apply-field-level-security-with-conditions/5696/1 "2021-04-21T11:14:58Z")

</div>

Hi,

I am trying to apply roles with field-level security containing a certain condition over the value that field holds. Is that possible?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Anthony](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/anthony/32/9939_2.png) [@Anthony](https://forum.opensearch.org/u/Anthony)\
**Post date:** [April 26, 2021, 1:14pm UTC](https://forum.opensearch.org/t/apply-field-level-security-with-conditions/5696/2 "2021-04-26T13:14:21Z")

</div>

hi @filipe

Can you provide a brief example of what you are trying to achieve? Might make it easier to help out

---

<div class="post-metadata">

**Author:** ![filipe](https://avatars.discourse-cdn.com/v4/letter/f/35a633/32.png) [@filipe](https://forum.opensearch.org/u/filipe)\
**Post date:** [April 28, 2021, 8:17am UTC](https://forum.opensearch.org/t/apply-field-level-security-with-conditions/5696/3 "2021-04-28T08:17:02Z")

</div>

Hi Anthony,

This is an example document:

```auto
    "field1": 1234,
    "field2": [
      {
        "sub-field1": "string",
        "sub-field2": true,
        "sub-field3": true
      }
    ],
    "field3": "string",

```

What I would like to achieve is the following:

If Field3 is not null and Field3 is a certain value: “value” then Field2 should not be part of the result document. Would it be possible to apply this with fls?

Thank you.
