# Not all fields are indexed

**URL:** https://discuss.elastic.co/t/not-all-fields-are-indexed/342369
**Category:** Elasticsearch
**Created:** [September 5, 2023, 6:37pm UTC](https://discuss.elastic.co/t/not-all-fields-are-indexed/342369 "2023-09-05T18:37:43Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Jim\_Song](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jim_song/32/122429_2.png) [@Jim\_Song](https://discuss.elastic.co/u/Jim_Song)
#### Post date: [September 5, 2023, 6:37pm UTC](https://discuss.elastic.co/t/not-all-fields-are-indexed/342369/1 "2023-09-05T18:37:43Z")

</div>

I indexed several raw json documents using BulkRequest index BinaryData from json string.

If I run a match all query, I am getting back all my documents. However only certain fields are searchable. Why aren't all fields searchable

```auto
{
    "took": 60,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 67,
            "relation": "eq"
        },
        "max_score": 1.0,
        "hits": [
            {
                "_index": "i-f827034e-a38f-3ea7-9a70-4a049a099de3",
                "_id": "BNyhR4oBYMuzxnj8uZ8M",
                "_score": 1.0,
                "_source": {
                    "id": "224903",
                    "category": "Person",
                    "Service Provider": "Commonwealth Trust Limited",
                    "CompanyType": "Standard Company under IBC Act",
                    "Latitude": "18.420695",
                    "Country Code": "VGB;HKG",
                    "Jurisdiction": "XXX",
                    "Status": "Active",
                    "Address": "Panocean Secretarial Services Limited Room 1708 Kai Tak Commercial Building 317-321 Des Voeux Road C Hong Kong RT BVI",
                    "Incorporation Date": "05-JAN-2005",
                    "Name": "Zipmatic Limited",
                    "Jursidiction Description": "Undetermined",
                    "Countries": "British Virgin Islands;Hong Kong",
                    "Label": "Person",
                    "Valid Until": "The Offshore Leaks data is current through 2010",
                    "Longitude": "-64.639968"
                }
            }
... ...

```

But only searching on id or category field returns any hits.

```auto
{
  "query": {
    "term": {
      "category": "person"
    }
  }
}
will return hits. But 
{
  "query": {
    "term": {
      "label": "person"
    }
  }
}
doesn't return any hits. Neither did most of other fields
{
    "took": 1,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 0,
            "relation": "eq"
        },
        "max_score": null,
        "hits": []
    }
}

```

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [September 5, 2023, 6:44pm UTC](https://discuss.elastic.co/t/not-all-fields-are-indexed/342369/2 "2023-09-05T18:44:48Z")

</div>

> [@Jim\_Song](#):
>
> `"category": "Person",`

> [@Jim\_Song](#):
>
> `"Label": "Person",`

Note that category is lower cased while Label start with an uppercase character.

> [@Jim\_Song](#):
>
> ```auto
> "term": {
> "label": "person"
> }
> 
> ```

In the query you however search for lowercased label.

---

<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: [September 6, 2023, 5:34am UTC](https://discuss.elastic.co/t/not-all-fields-are-indexed/342369/3 "2023-09-06T05:34:19Z")

</div>

Using a Match query instead of Term query might solve the problem as well.

---

<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: [October 4, 2023, 5:34am UTC](https://discuss.elastic.co/t/not-all-fields-are-indexed/342369/4 "2023-10-04T05:34:22Z")

</div>

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