# Check if keyword is in text

**URL:** <https://discuss.elastic.co/t/check-if-keyword-is-in-text/219724>\
**Category:** Elasticsearch\
**Created:** [February 18, 2020, 7:24am UTC](https://discuss.elastic.co/t/check-if-keyword-is-in-text/219724 "2020-02-18T07:24:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rcbfred](https://avatars.discourse-cdn.com/v4/letter/r/d9b06d/32.png) [@rcbfred](https://discuss.elastic.co/u/rcbfred)\
**Post date:** [February 18, 2020, 7:24am UTC](https://discuss.elastic.co/t/check-if-keyword-is-in-text/219724/1 "2020-02-18T07:24:56Z")

</div>

So I have about 22,000 Boolean-like Keywords(e.g. ("stock market") ("trading"), ("ecology"|"pollution"), etc.) in an index and I want to query for those documents whose keyword can be found in a certain text.

```
   {
  "mapping": {
    "properties": {
                   "id": {
                          "type": "long"
                         },
                   "word": {
                          "type": "text",
                           "fields": {
                                      "keyword": {
                                                  "type": "keyword",
                                                   "ignore_above": 256
                                                 }
                                      }
      },
    }
  }
}

```

These are examples of what this index's records look like:

```
"id" : 41074
"word" : """("Technical-Vocational-Livelihood "|"TVL") ("Track")""",

 "id" : 38684,
 "word" : """("Special Education Program")""",

```

Now, I want to filter only the documents whose "word" can be found in a specific text, E.G.

> …Here, a student has the following options: prepare for college education, look for work, or start a business after graduation. K-12, which took effect in 2016, has four tracks: academic, technical-vocational-livelihood (TVL), arts and design and sports. “Before, when you drop out of high school, you are really a dropout; as you are expected to proceed to college or higher education…

Can you help me out with what I want to achieve? I was thinking of filtering the records by using the filter API and a script. Any help would be appreciated. Thanks!

---

<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:** [March 17, 2020, 7:25am UTC](https://discuss.elastic.co/t/check-if-keyword-is-in-text/219724/2 "2020-03-17T07:25:01Z")

</div>

Closed on March 17, 2020, 7:25am UTC

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