# Transform is not created when a particular field is not available in the index

**URL:** <https://discuss.elastic.co/t/transform-is-not-created-when-a-particular-field-is-not-available-in-the-index/312214>\
**Category:** Kibana\
**Tags:** transforms\
**Created:** [August 16, 2022, 7:16pm UTC](https://discuss.elastic.co/t/transform-is-not-created-when-a-particular-field-is-not-available-in-the-index/312214 "2022-08-16T19:16:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amol](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@Amol](https://discuss.elastic.co/u/Amol)\
**Post date:** [August 16, 2022, 7:16pm UTC](https://discuss.elastic.co/t/transform-is-not-created-when-a-particular-field-is-not-available-in-the-index/312214/1 "2022-08-16T19:16:11Z")

</div>

Hello Team,

I'm trying to create a transform, it is creating the transform index, but when the particular (Year column) is blank or not available in the Data set document, that document is not index.

Could any one help in the below transform json query!

```auto
PUT _transform/year-test1
{
  "source": {
    "index": [
      "newyear22"
    ]
  },
  "pivot": {
    "group_by": {
      "usrid.keyword": {
        "terms": {
          "field": "usrid.keyword"
        }
      },
      "dept.keyword": {
        "terms": {
          "field": "dept.keyword"
        }
      },
      "year.keyword": {
        "terms": {
          "field": "year.keyword"
        }
      }
    },
    "aggregations": {
      "activity.keyword.cardinality": {
        "cardinality": {
          "field": "activity.keyword"
        }
      }
    }
  },
  "description": "Transform testing Year null values",
  "frequency": "1m",
  "dest": {
    "index": "year-test1"
  },
  "sync": {
    "time": {
      "field": "@timestamp",
      "delay": "60s"
    }
  },
  "settings": {
    "max_page_search_size": 500
  }
}

```

Many thanks in advance!!  
@Amol

---

<div class="post-metadata">

**Author:** ![sophie\_chang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sophie_chang/32/18008_2.png) [@sophie\_chang](https://discuss.elastic.co/u/sophie_chang)\
**Post date:** [August 17, 2022, 12:37pm UTC](https://discuss.elastic.co/t/transform-is-not-created-when-a-particular-field-is-not-available-in-the-index/312214/2 "2022-08-17T12:37:12Z")

</div>

Assuming the field in the document is sometimes blank, it sounds like you will need to get a bit more creative with your aggregation.

Support for the `missing` aggregation was added in 7.11. Alternatively you may require a runtime field, or you could resolve the missing data at ingest.

This is not configurable via the UI, so you will need to use Dev Tools to create the transform. (When editing in Dev Tools, suggest using `_preview` as a way to more easily validate the syntax.)

---

<div class="post-metadata">

**Author:** ![Amol](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@Amol](https://discuss.elastic.co/u/Amol)\
**Post date:** [August 18, 2022, 2:31am UTC](https://discuss.elastic.co/t/transform-is-not-created-when-a-particular-field-is-not-available-in-the-index/312214/3 "2022-08-18T02:31:14Z")

</div>

Thank you @sophie_chang for your response.

It worked for me by adding one more lines to the fields section.

```auto
"missing_bucket": true

```

---

<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:** [September 15, 2022, 2:31am UTC](https://discuss.elastic.co/t/transform-is-not-created-when-a-particular-field-is-not-available-in-the-index/312214/4 "2022-09-15T02:31:37Z")

</div>

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