# How should I format a post\_filter query to match a string inside of a string?

**URL:** https://discuss.elastic.co/t/how-should-i-format-a-post-filter-query-to-match-a-string-inside-of-a-string/107464
**Category:** Elasticsearch
**Created:** [November 13, 2017, 9:14pm UTC](https://discuss.elastic.co/t/how-should-i-format-a-post-filter-query-to-match-a-string-inside-of-a-string/107464 "2017-11-13T21:14:30Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![simonstiph](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@simonstiph](https://discuss.elastic.co/u/simonstiph)
#### Post date: [November 13, 2017, 9:14pm UTC](https://discuss.elastic.co/t/how-should-i-format-a-post-filter-query-to-match-a-string-inside-of-a-string/107464/1 "2017-11-13T21:14:30Z")

</div>

I have an array of articles (i.e. from newspapers) in a MongoDB database that is indexed into Elasticsearch. Each article has any number of authors, like: ['John Doe', 'Jane Doe'].

In Es, I have aggregation by author working properly, but I also want to apply a post\_filter to filter results by author. How should a post\_filter query be designed to handle this?

Article schema in Es (can be modified if necessary):

```
{
  ...
  authors: ['Michael Jordan', 'Kobe Bryant'],
  authorsString: 'Michael Jordan;Kobe Bryant;'
}

```

This is an example query before applying the post\_filter:

```
{
  ...
  aggs: {
    authors: {
      terms: {
        field: 'authors.keyword',
      },
    },
  },
  post_filter: {},
}

```

If I want to find articles of which at least one of the authors is "Michael Jordan", how do I use post\_filter to do so?

---

<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: [December 11, 2017, 9:14pm UTC](https://discuss.elastic.co/t/how-should-i-format-a-post-filter-query-to-match-a-string-inside-of-a-string/107464/2 "2017-12-11T21:14:32Z")

</div>

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