Terms aggregation on a keyword field returns no results

I have Elastic search v7.2 with an index of 20 million documents.
Part of es schema is as follows;

{
  "properties": {
    "industries_name": {
      "copy_to": [
        "keyword_search_copy_to_field"
      ],
    "type": "text",
    "fields": {
        "industries_name_keyword": {
          "eager_global_ordinals": true,
          "type": "keyword"
        }
      }
    }
  }
}

With this I am executing the following aggregation;

    {
       "aggs": {
        "industries": {
          "terms": {
            "field": "industries_name.industries_name_keyword",
            "size": 150
          }
        }
      },
      "from": 0,
      "size": 0
    }

Unfortunately, this query returns no aggregation buckets.

{
  "took": 79,
  "timed_out": false,
  "_shards": {
    "total": 6,
    "successful": 6,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 10000,
      "relation": "gte"
    },
    "max_score": null,
    "hits": []
  },
  "aggregations": {
    "industries": {
      "doc_count_error_upper_bound": 0,
      "sum_other_doc_count": 0,
      "buckets": []
    }
  }
}

What may be the reason?

NB: Data exist for the field

I can't see a reason.

Could you share a typical document you have indexed and the full mapping?

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