# Problem to create a TermsQuery using list of integers

**URL:** <https://discuss.elastic.co/t/problem-to-create-a-termsquery-using-list-of-integers/290644>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [December 1, 2021, 9:40am UTC](https://discuss.elastic.co/t/problem-to-create-a-termsquery-using-list-of-integers/290644 "2021-12-01T09:40:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kirtash](https://avatars.discourse-cdn.com/v4/letter/k/a8b319/32.png) [@Kirtash](https://discuss.elastic.co/u/Kirtash)\
**Post date:** [December 1, 2021, 9:40am UTC](https://discuss.elastic.co/t/problem-to-create-a-termsquery-using-list-of-integers/290644/1 "2021-12-01T09:40:02Z")

</div>

Good morning,

I'm using the library nest in C# to write bool queries but I would like create a termsquery with a list of integers, like when I use strings:

```auto

List<string> hiValues = new List<string>();

                TermsQuery query = new()
                {
                    Field = "fieldKey",
                    Terms = hiValues 
                };

```

The problem is the field Terms is an Enumerable, and I can't convert the list of integers of this type. My option now is convert the list of integers to string but I don't know if exists any better option.

Thanks for the 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:** [December 29, 2021, 9:40am UTC](https://discuss.elastic.co/t/problem-to-create-a-termsquery-using-list-of-integers/290644/2 "2021-12-29T09:40:03Z")

</div>

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