# Searching using a column of type number doesn't work

**URL:** <https://discuss.elastic.co/t/searching-using-a-column-of-type-number-doesnt-work/177128>\
**Category:** Elasticsearch\
**Created:** [April 16, 2019, 4:51pm UTC](https://discuss.elastic.co/t/searching-using-a-column-of-type-number-doesnt-work/177128 "2019-04-16T16:51:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guilian](https://avatars.discourse-cdn.com/v4/letter/g/58f4c7/32.png) [@Guilian](https://discuss.elastic.co/u/Guilian)\
**Post date:** [April 16, 2019, 4:51pm UTC](https://discuss.elastic.co/t/searching-using-a-column-of-type-number-doesnt-work/177128/1 "2019-04-16T16:51:39Z")

</div>

Hello,  
there is a search field in my website that is used to search objects from type Program.  
The Program class contains a Property called ProgramNumber from type integer which is entered by the user to start the search.

My problem is that the search doesn't give me any results when I set the DefaultField to "programNumber". But when I set string field like "name" or "description" as Defaultfield the search works.

Please can you help me to fix this problem?

Here is my code:

```
public async Task<IEnumerable<T>> Search<T>(string searchTerm) where T : class
    {
        var request = CreateSearchQuery<T>(searchTerm);
        var response = await _elasticClient.SearchAsync<T>(request);

        var items = response.Documents;
        return items;
    }

    private ISearchRequest CreateSearchQuery<T>(string searchTerm) where T : class
    {
        var searchRequest = new SearchRequest<T>(Indices.All, Types.All)
        {
            Size = 10,
            Query = new QueryStringQuery
            {
                DefaultField = "programNumber",
                Query = GetQueryString(searchTerm),
                Fuzziness = Fuzziness.Auto,
                FuzzyPrefixLength = 0,
                FuzzyMaxExpansions = 50,
                Lenient = true,
                AnalyzeWildcard = true,
                DefaultOperator = Operator.Or,
                Boost = 1
            }

        };

        return searchRequest;
    }

```

Thanks in advance for your help 🙂

---

<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:** [May 14, 2019, 4:51pm UTC](https://discuss.elastic.co/t/searching-using-a-column-of-type-number-doesnt-work/177128/2 "2019-05-14T16:51:47Z")

</div>

Closed on May 14, 2019, 4:51pm UTC

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