Delete fields from existing index

Hi,

While inserting data to elastic search I got the below error.

{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Limit of total fields [1000] in index [my_index] has been exceeded"
}
],
"type": "illegal_argument_exception",
"reason": "Limit of total fields [1000] in index [my_index] has been exceeded"
},
"status": 400
}

Now I want to remove fields which are created wrongly.

Please provide me the procedure to delete/remove the wrongly created fields from the existing index

Eg:

I want to delete the fields which are highlighted in attached image

You need to reindex for that.

Thanks for the quick reply.

I have few quick questions

  1. In general how much time will it take to reindex?
  2. Do reindex looses my existing data?

What is the procedure to reindex without having wrongly created fields(multiple fields).

  1. It depends
  2. Reindex means : read from an old index and write a new one so you won't loose your data
  3. There is an example in https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html about removing a field named foo.

Below line helps to remove single field. But, I need to remove many such fields. Is there any option in the script to remove multiple fields?

"source": "if (ctx._source.foo == 'bar') {ctx._version++; ctx._source.remove('foo')}"

Probably by iteration on a list of fields with a for loop? I'm not a painless script expert so I can't help more here I think.

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