# Elasticsearch can't recognize phrase terms?

**URL:** <https://discuss.elastic.co/t/elasticsearch-cant-recognize-phrase-terms/202104>\
**Category:** Elasticsearch\
**Created:** [October 3, 2019, 7:19am UTC](https://discuss.elastic.co/t/elasticsearch-cant-recognize-phrase-terms/202104 "2019-10-03T07:19:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Noctis17](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/noctis17/32/41656_2.png) [@Noctis17](https://discuss.elastic.co/u/Noctis17)\
**Post date:** [October 3, 2019, 7:19am UTC](https://discuss.elastic.co/t/elasticsearch-cant-recognize-phrase-terms/202104/1 "2019-10-03T07:19:11Z")

</div>

From my StackOverflow post:

> <https://stackoverflow.com/questions/58214102/elasticsearch-cant-recognize-phrase-terms>

I'm trying to count how many times / documents my `terms or keywords` occurred from my specified query

Here's my aggregation query:

```auto
"aggs" => [
    "KEYWORDS" => [
        "filters" => [
            "filters" => [
                "term1" => [
                    "term" => [
                        'content' => "isko"
                    ]
                ],
                "term2" => [
                    "term" => [
                        'content' => "manila"
                    ]
                ]
            ]
        ]
    ]
]

```

and here's the response:

[![Output 1](https://us1.discourse-cdn.com/elastic/original/3X/3/5/352b408aa5c6180e41e9f1dd2bf98f4373f4c82e.png)](https://i.stack.imgur.com/7Gshl.png)

I'm almost near to my desired output, however when I wanted the **right** phrase / keywords, it is not being recognized by Elasticsearch

```auto
"aggs" => [
    "KEYWORDS" => [
        "filters" => [
            "filters" => [
                "term1" => [
                    "term" => [
                        'content' => "mayor isko moreno"
                    ]
                ],
                "term2" => [
                    "term" => [
                        'content' => "mayor vico sotto"
                    ]
                ]
            ]
        ]
    ]
]

```

_new response_

[![Output 2](https://us1.discourse-cdn.com/elastic/original/3X/0/e/0e111d39bf3bfb125620f76eecedccf8f520241a.png)](https://i.stack.imgur.com/fxyXD.png)

Does this mean Elasticsearch can't recognize phrases?

P.S. I'm developing a Laravel app (a PHP-based framework, so I'm using the official Elastcisearch PHP API [https://github.com/elastic/elasticsearch-php](https://github.com/elastic/elasticsearch-php))

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 3, 2019, 7:28am UTC](https://discuss.elastic.co/t/elasticsearch-cant-recognize-phrase-terms/202104/2 "2019-10-03T07:28:27Z")

</div>

Please don’t post duplicate questions.  
Did you look into the “shingles” feature I suggested in your other post?

---

<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:** [October 31, 2019, 7:28am UTC](https://discuss.elastic.co/t/elasticsearch-cant-recognize-phrase-terms/202104/3 "2019-10-31T07:28:53Z")

</div>

Closed on October 31, 2019, 7:28am UTC

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