# Native script use case

**URL:** https://discuss.elastic.co/t/native-script-use-case/89028
**Category:** Elasticsearch
**Created:** [June 12, 2017, 11:22am UTC](https://discuss.elastic.co/t/native-script-use-case/89028 "2017-06-12T11:22:04Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![msin](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@msin](https://discuss.elastic.co/u/msin)
#### Post date: [June 12, 2017, 11:22am UTC](https://discuss.elastic.co/t/native-script-use-case/89028/1 "2017-06-12T11:22:04Z")

</div>

in elasticsearch 5.4, the following inline query works:

```auto
{
   "query": {
      "bool": {
         "filter": {
            "script": {
               "script": "def match = true; return match;"
            }
         }
      }
   }
}

```

suppose that a custom condition is used instead of true.

is it possible to write the same query using native script (java plugin)?

---

<div class="post-metadata">

### Author: ![msin](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@msin](https://discuss.elastic.co/u/msin)
#### Post date: [June 12, 2017, 12:06pm UTC](https://discuss.elastic.co/t/native-script-use-case/89028/2 "2017-06-12T12:06:52Z")

</div>

I used the query script and it worked. sorry.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 10, 2017, 12:07pm UTC](https://discuss.elastic.co/t/native-script-use-case/89028/3 "2017-07-10T12:07:19Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
