# Searching for a few fields from Set Collection

**URL:** <https://discuss.elastic.co/t/searching-for-a-few-fields-from-set-collection/117189>\
**Category:** Elasticsearch\
**Created:** [January 26, 2018, 12:27pm UTC](https://discuss.elastic.co/t/searching-for-a-few-fields-from-set-collection/117189 "2018-01-26T12:27:40Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [January 26, 2018, 12:51pm UTC](https://discuss.elastic.co/t/searching-for-a-few-fields-from-set-collection/117189/2 "2018-01-26T12:51:29Z")

</div>

This works well:

```auto
DELETE test 
PUT test/doc/1
{
	"level": ["DEBUG", "INFO"]
}
PUT test/doc/2
{
	"level": ["ERROR", "INFO"]
}
PUT test/doc/3
{
	"level": ["INFO"]
}
GET test/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "level": {
              "value": "debug"
            }
          }
        }, {
          "term": {
            "level": {
              "value": "info"
            }
          }
        }
      ]
    }
  }
}

```

And gives:

```auto
{
  "took": 6,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 1,
    "max_score": 0.5753642,
    "hits": [
      {
        "_index": "test",
        "_type": "doc",
        "_id": "1",
        "_score": 0.5753642,
        "_source": {
          "level": [
            "DEBUG",
            "INFO"
          ]
        }
      }
    ]
  }
}

```

First thing to do is to reproduce the problem with just a script like I did. Then try to understand what is wrong.  
Here, I'm almost sure (but you did not share your mapping), that you are searching on a `text` field with default analyzer, using a `term` query with uppercase terms like `DEBUG` and `INFO`. Which is not going to work.

---

_[View the full topic](https://discuss.elastic.co/t/searching-for-a-few-fields-from-set-collection/117189)._
