# Unable to use field named "\_Data" in Sql query anymore

**URL:** <https://discuss.elastic.co/t/unable-to-use-field-named-data-in-sql-query-anymore/158786>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-sql\
**Created:** [November 29, 2018, 3:09pm UTC](https://discuss.elastic.co/t/unable-to-use-field-named-data-in-sql-query-anymore/158786 "2018-11-29T15:09:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Magnus\_Andersson1](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@Magnus\_Andersson1](https://discuss.elastic.co/u/Magnus_Andersson1)\
**Post date:** [November 29, 2018, 3:09pm UTC](https://discuss.elastic.co/t/unable-to-use-field-named-data-in-sql-query-anymore/158786/1 "2018-11-29T15:09:46Z")

</div>

Hi,

I have a document looking like this, copied from the \_source property of a Elastic query result:

```auto
    {
          "AbstractId" : "7f424fa0-f30e-477d-8245-d3b4e97e0538",
          "Category" : "GUI",
          "Created" : "2018-10-30T14:49:59.936",
          "MessageId" : "33ced315-7af6-40b9-9f23-d372756c74db",
          "StrongTypeName" : "Milestone",
          "_Data" : {
            "PurposeCode" : null,
            "Type" : "ABC",
            "Created" : null,
            "ShipmentId" : "abcd1234"
          }

```

Using the the same document in the same index before the upgrade to 6.5.1, I could refer to the \_Data. without any problem using Sql, for example:  
select \_Data.ShipmentId, count(\_Data.Type) as cnt from index\_shipments where \_Data.Type.keyword = 'ICP' group by \_Data.ShipmentId, \_Data.Type.keyword

Now, it seems that the propery "\_Data" is not available when using Sql:  
"Unknown column [\_Data.Type.keyword], did you mean any of [Category.keyword, StrongTypeName.keyword, AbstractId.keyword, MessageId.keyword]"

If I use "select \* from ...." for that document, I get this back, the "\_Data" property is not returned in the result at all (which probably explains the error message):

```auto
        {
	"columns": [
		{
			"name": "AbstractId",
			"type": "text"
		},
		{
			"name": "Category",
			"type": "text"
		},
		{
			"name": "Created",
			"type": "date"
		},
		{
			"name": "MessageId",
			"type": "text"
		},
		{
			"name": "StrongTypeName",
			"type": "text"
		}
	],
	"rows": [
		[
			"7f424fa0-f30e-477d-8245-d3b4e97e0538",
			"GUI",
			"2018-10-30T14:49:59.936Z",
			"33ced315-7af6-40b9-9f23-d372756c74db",
			"Milestone"
		]
	]
}

```

Could this be an issue introduced in the latest release or is it me doing something wrong here?

Regards  
/Magnus

---

<div class="post-metadata">

**Author:** ![Andrei\_Stefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei_stefan/32/47533_2.png) [@Andrei\_Stefan](https://discuss.elastic.co/u/Andrei_Stefan)\
**Post date:** [December 2, 2018, 9:54pm UTC](https://discuss.elastic.co/t/unable-to-use-field-named-data-in-sql-query-anymore/158786/2 "2018-12-02T21:54:15Z")

</div>

Hi @Magnus_Andersson1,  
What is the mapping of `_Data` field? Please, provide the full mapping definition.

---

<div class="post-metadata">

**Author:** ![Magnus\_Andersson1](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@Magnus\_Andersson1](https://discuss.elastic.co/u/Magnus_Andersson1)\
**Post date:** [December 3, 2018, 10:33am UTC](https://discuss.elastic.co/t/unable-to-use-field-named-data-in-sql-query-anymore/158786/3 "2018-12-03T10:33:10Z")

</div>

Here is the mapping:

```auto
 {
  "mapping": {
    "_doc": {
      "properties": {
        "AbstractId": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "Category": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "Created": {
          "type": "date"
        },
        "MessageId": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "StrongTypeName": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "_Data": {
          "properties": {
            "ShipmentId": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "Type": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            }
          }
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![Andrei\_Stefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei_stefan/32/47533_2.png) [@Andrei\_Stefan](https://discuss.elastic.co/u/Andrei_Stefan)\
**Post date:** [December 4, 2018, 10:10am UTC](https://discuss.elastic.co/t/unable-to-use-field-named-data-in-sql-query-anymore/158786/4 "2018-12-04T10:10:28Z")

</div>

Hey @Magnus_Andersson1,  
Indeed, a bug. Created issue [here](https://github.com/elastic/elasticsearch/issues/36206) and we'll look into it. Thanks for reporting.

---

<div class="post-metadata">

**Author:** ![Magnus\_Andersson1](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@Magnus\_Andersson1](https://discuss.elastic.co/u/Magnus_Andersson1)\
**Post date:** [December 4, 2018, 10:51am UTC](https://discuss.elastic.co/t/unable-to-use-field-named-data-in-sql-query-anymore/158786/5 "2018-12-04T10:51:24Z")

</div>

Great, thanks!  
/Magnus

---

<div class="post-metadata">

**Author:** ![Andrei\_Stefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei_stefan/32/47533_2.png) [@Andrei\_Stefan](https://discuss.elastic.co/u/Andrei_Stefan)\
**Post date:** [December 13, 2018, 12:27pm UTC](https://discuss.elastic.co/t/unable-to-use-field-named-data-in-sql-query-anymore/158786/6 "2018-12-13T12:27:06Z")

</div>

@Magnus_Andersson1 the bug is fixed. Will be available in 6.6.0.

---

<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:** [January 10, 2019, 12:27pm UTC](https://discuss.elastic.co/t/unable-to-use-field-named-data-in-sql-query-anymore/158786/7 "2019-01-10T12:27:19Z")

</div>

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