# Returning too many results?

**URL:** <https://discuss.elastic.co/t/returning-too-many-results/191243>\
**Category:** Elasticsearch\
**Created:** [July 18, 2019, 4:21pm UTC](https://discuss.elastic.co/t/returning-too-many-results/191243 "2019-07-18T16:21:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![linus](https://avatars.discourse-cdn.com/v4/letter/l/f4b2a3/32.png) [@linus](https://discuss.elastic.co/u/linus)\
**Post date:** [July 18, 2019, 4:21pm UTC](https://discuss.elastic.co/t/returning-too-many-results/191243/1 "2019-07-18T16:21:44Z")

</div>

Hi All. I'm new to ElasticSearch so am still trying to understand how it handles match queries. I have a bunch of docs in my index that have a array field, called keywordSearchTags" for keyword searching. So a document may look something like this:

```
{
            "_index": "3ooij_costs",
            "_type": "_doc",
            "_id": "33295",
            "_score": 1,
            "_source": {
                "projectLocation": "05-16-035-06W4",
                "amount": 2962.46,
                "Service Description": "Environmental - Execution",
                "Service Provider": "Engineering",
                "projectTemplate": "Default Template",
                "budgetId": 8835,
                "budgetName": "Budget 09/21/2016 21:19:42",
                "createdOn": "2017-02-05T19:20:53.000Z",
                "organizationId": 455,
                "projectStatus": "Active",
                "projectKey": "xq4rbtvl",
                "workDate": "2017-01-17T00:00:00.000Z",
                "Invoice #": "4058",
                "createdBy": "John Doe",
                "budgetAmount": 2962.46,
                "Coding": "A7BY 7550/761",
                "projectOwner": "Energy Corp",
                "projectAssignee": "Energy Ltd",
                "projectName": "100/05-16-035-06W4/00",
                "fiscalYear": 2017,
                "projectId": 12601,
                "keywordSearchTags": [
                    "John Doe",
                    "Budget 09/21/2016 21:19:42",
                    "100/05-16-035-06W4/00",
                    "Energy Corp",
                    "Energy Ltd",
                    "Default Template",
                    "05-16-035-06W4"
                ]
            }
        }

```

If I do a match query against keywrdSearchTags, say, the words "Energy Ltd." I will get the right number of relevant matches. But if I search for a code like "100/05-16-035-06W4/00", I get a huge number of results back, rather than something that matches my string. These sorts of codes are used by our clients to find a location, so they should be as accurate as possible. Yet, I would get 800 hits with many of them not matching this code at all. Is there something that's different strings with numbers like this that is handled differently? How can I get a more accurate result?

thanks

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 18, 2019, 4:40pm UTC](https://discuss.elastic.co/t/returning-too-many-results/191243/2 "2019-07-18T16:40:40Z")

</div>

Change the field type from `text` to `keyword`.

---

<div class="post-metadata">

**Author:** ![linus](https://avatars.discourse-cdn.com/v4/letter/l/f4b2a3/32.png) [@linus](https://discuss.elastic.co/u/linus)\
**Post date:** [July 18, 2019, 5:13pm UTC](https://discuss.elastic.co/t/returning-too-many-results/191243/3 "2019-07-18T17:13:08Z")

</div>

Thanks, dadoonet.

I am not using the keyword type, because I don't want to do an exact match. For example, if a user just types in the word "Energy" the relevant results will should still pop up. If anything, I just want to understand why there's such a contrast with the search results between "Energy" and "100/05-16-035-06W4/00".

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 18, 2019, 5:25pm UTC](https://discuss.elastic.co/t/returning-too-many-results/191243/4 "2019-07-18T17:25:48Z")

</div>

Run the analyze API on your text with a standard analyzer and you should understand why.

---

<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:** [August 15, 2019, 5:25pm UTC](https://discuss.elastic.co/t/returning-too-many-results/191243/5 "2019-08-15T17:25:52Z")

</div>

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