# Vega request @timestamp not mapped to timestamp field

**URL:** <https://discuss.elastic.co/t/vega-request-timestamp-not-mapped-to-timestamp-field/257200>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [December 1, 2020, 11:54am UTC](https://discuss.elastic.co/t/vega-request-timestamp-not-mapped-to-timestamp-field/257200 "2020-12-01T11:54:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ewolfman](https://avatars.discourse-cdn.com/v4/letter/e/5f8ce5/32.png) [@ewolfman](https://discuss.elastic.co/u/ewolfman)\
**Post date:** [December 1, 2020, 11:54am UTC](https://discuss.elastic.co/t/vega-request-timestamp-not-mapped-to-timestamp-field/257200/1 "2020-12-01T11:54:44Z")

</div>

Hi,

I am using Kibana and ES 7.10.0.

I have a vega-lite widget that works and fetches from Elasticsearch the data. When trying using @timestamp in a vega-lite widget I get no results, and the warning: "_Infinite extent for field "doc\_count": [Infinity, -Infinity]_".

Ref: [https://www.elastic.co/guide/en/kibana/current/vega-reference.html#vega-queries](https://www.elastic.co/guide/en/kibana/current/vega-reference.html#vega-queries)

```
{
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "data": {
    "url": {
      // Filter the time picker (upper right corner) with this field
      %timefield%: @timestamp
      // Apply dashboard context filters when set
      %context%: true
      "index": "my_index",
      "body": {
        "aggs": {
          "aaa": {
            "nested": {"path": "xxx"},
            "aggs": {
              "bbb": {
                "nested": {"path": "xxx.yyy"},
                "aggs": {
                  "ccc": {
                    "terms": {
                      "field": "xxx.yyy.zzz",
                      "size": 4
                    }
                  }
                }
              }
            }
          }
        },
        "size": 0
      }
    },
    "format": {"property": "aggregations.aaa.bbb.ccc.buckets"}
  },
  "encoding": {
    "x": {"field": "key", "type": "nominal", "axis": {"title": false}},
    "y": {
      "field": "doc_count",
      "type": "quantitative",
      "axis": {"title": "Document count"}
    }
  },
  "layer": [
    {"mark": "bar"},
    {
      "mark": {"type": "text", "align": "left", "baseline": "middle", "dy": 10},
      "encoding": {"text": {"field": "doc_count", "type": "quantitative"}}
    }
  ]
}

```

Using the Inspect tool I can see that the request to ES contains the following:

```auto
// rest of code left out for clarity
"range": {
  "@timestamp": {
    "gte": "2018-12-01T11:37:26.326Z",
    "lte": "2020-12-01T11:37:26.326Z",
    "format": "strict_date_optional_time"
  }
}

```

Shouldn't @timestamp have been replaced with the Index Pattern's @timestamp ('creation\_timestamp' in my case).

When I remove '%timefield%: @timestamp' and explicitly add a query clause with the timestamp as follows, it works well:

```auto
// rest of code left out for clarity
"range": {
  "creation_timestamp": {
    "%timefilter%": true,
    "format": "strict_date_optional_time"
   }
}

```

I double-checked that my Index Pattern has @timestamp set to 'creation\_timestamp'.

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)\
**Post date:** [December 1, 2020, 1:49pm UTC](https://discuss.elastic.co/t/vega-request-timestamp-not-mapped-to-timestamp-field/257200/2 "2020-12-01T13:49:29Z")

</div>

Have you tried `%timefield%: creation_timestamp`

---

<div class="post-metadata">

**Author:** ![ewolfman](https://avatars.discourse-cdn.com/v4/letter/e/5f8ce5/32.png) [@ewolfman](https://discuss.elastic.co/u/ewolfman)\
**Post date:** [December 1, 2020, 1:59pm UTC](https://discuss.elastic.co/t/vega-request-timestamp-not-mapped-to-timestamp-field/257200/3 "2020-12-01T13:59:57Z")

</div>

Adding `%timefield%: creation_timestamp` works, but the question remains. Shouldn't it work with @timestamp?

---

<div class="post-metadata">

**Author:** ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)\
**Post date:** [December 1, 2020, 2:16pm UTC](https://discuss.elastic.co/t/vega-request-timestamp-not-mapped-to-timestamp-field/257200/4 "2020-12-01T14:16:22Z")

</div>

I am not sure how it was setup or what your data/mapping looks like so I am not sure if that method works or not, never tried it.

But I would just use the field you want to work with and it seems like it's `creation_timestamp` unless I am missing something.

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [December 1, 2020, 2:57pm UTC](https://discuss.elastic.co/t/vega-request-timestamp-not-mapped-to-timestamp-field/257200/5 "2020-12-01T14:57:01Z")

</div>

You need to specify the exact field name, Vega isn't able to guess.

---

<div class="post-metadata">

**Author:** ![ewolfman](https://avatars.discourse-cdn.com/v4/letter/e/5f8ce5/32.png) [@ewolfman](https://discuss.elastic.co/u/ewolfman)\
**Post date:** [December 1, 2020, 3:27pm UTC](https://discuss.elastic.co/t/vega-request-timestamp-not-mapped-to-timestamp-field/257200/6 "2020-12-01T15:27:10Z")

</div>

Thanks, understood.  
Looking back there are probably 2-3 things that led me to think that @timestamp is a 'feature':

1. The Kibana vega template uses @timestamp. And results for \_all are fetched.
2. The [documentation](https://www.elastic.co/guide/en/kibana/current/vega-reference.html#vega-queries) uses @timestamp and has a note which reads: " _`@timestamp` — Filters the time range and breaks it into histogram buckets._"
3. When you create an Index Pattern you get to specify the timestamp for the index.

But now I realize that the Kibana vega template is using @timestamp and fetches results only from `.kibana-event-log-7.10.0-000001` log (on my setup), which has a property of `@timestamp` and that is the only reason why this had worked, and has nothing to do with the Index Pattern as the vega specifies the index directly.

I would suggest changing the comment in the documentation from " _`@timestamp` — Filters the time range and breaks it into histogram buckets._" so that it will be clear that you need to use an actual property name from your index.

Thanks.

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [December 1, 2020, 4:14pm UTC](https://discuss.elastic.co/t/vega-request-timestamp-not-mapped-to-timestamp-field/257200/7 "2020-12-01T16:14:52Z")

</div>

Thanks for the suggestion, I think it makes sense to clarify this. The field name @timestamp is standardized as part of our Elastic Common Schema, but this isn't always obvious.

---

<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, 2020, 4:14pm UTC](https://discuss.elastic.co/t/vega-request-timestamp-not-mapped-to-timestamp-field/257200/8 "2020-12-29T16:14:52Z")

</div>

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