Returning too many results?

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

Change the field type from text to keyword.

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".

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

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