# Elasticsearch index

**URL:** <https://discuss.elastic.co/t/elasticsearch-index/298257>\
**Category:** Elasticsearch\
**Created:** [February 25, 2022, 9:10am UTC](https://discuss.elastic.co/t/elasticsearch-index/298257 "2022-02-25T09:10:30Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![umangpatel](https://avatars.discourse-cdn.com/v4/letter/u/3bc359/32.png) [@umangpatel](https://discuss.elastic.co/u/umangpatel)\
**Post date:** [February 25, 2022, 9:10am UTC](https://discuss.elastic.co/t/elasticsearch-index/298257/1 "2022-02-25T09:10:30Z")

</div>

I have to remove old data of apiman-indices in Elasticsearch which contain .pos, .cf or any other extension. So how can we remove the old indices?

---

<div class="post-metadata">

**Author:** ![sholzhauer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sholzhauer/32/110282_2.png) [@sholzhauer](https://discuss.elastic.co/u/sholzhauer)\
**Post date:** [February 25, 2022, 9:53am UTC](https://discuss.elastic.co/t/elasticsearch-index/298257/2 "2022-02-25T09:53:31Z")

</div>

Do you mean you have to remove the documents (events) in you indices with this information?

If so, is this stored in a specific field or part of a field?

---

<div class="post-metadata">

**Author:** ![umangpatel](https://avatars.discourse-cdn.com/v4/letter/u/3bc359/32.png) [@umangpatel](https://discuss.elastic.co/u/umangpatel)\
**Post date:** [February 25, 2022, 10:06am UTC](https://discuss.elastic.co/t/elasticsearch-index/298257/3 "2022-02-25T10:06:03Z")

</div>

yes how can i remove this

---

<div class="post-metadata">

**Author:** ![sholzhauer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sholzhauer/32/110282_2.png) [@sholzhauer](https://discuss.elastic.co/u/sholzhauer)\
**Post date:** [February 25, 2022, 10:07am UTC](https://discuss.elastic.co/t/elasticsearch-index/298257/4 "2022-02-25T10:07:44Z")

</div>

You should be able to do this with a [delete\_by\_query](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html)

Could you perhaps share an example doc?

---

<div class="post-metadata">

**Author:** ![Tulsi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tulsi/32/99289_2.png) [@Tulsi](https://discuss.elastic.co/u/Tulsi)\
**Post date:** [February 27, 2022, 4:23am UTC](https://discuss.elastic.co/t/elasticsearch-index/298257/5 "2022-02-27T04:23:11Z")

</div>

There are many ways to do it:

1. if you know the doc id which needs to be removed use:  
`DELETE /<index>/_doc/<_id>`

2. if you have many docs to be remove then use ( which can be identified via a query) then use :

```auto
POST /my-index-000001/_delete_by_query
{
  "query": {
    "match": {
      "user.id": "elkbee"
    }
  }
}

```

1. if you want to delete the index itself then use :  
`DELETE /<index>`

yiu can use all these apis in kibana interface .

---

<div class="post-metadata">

**Author:** ![umangpatel](https://avatars.discourse-cdn.com/v4/letter/u/3bc359/32.png) [@umangpatel](https://discuss.elastic.co/u/umangpatel)\
**Post date:** [February 28, 2022, 8:29am UTC](https://discuss.elastic.co/t/elasticsearch-index/298257/6 "2022-02-28T08:29:24Z")

</div>

NO no, Actually i want to remove APIMAN-METRICS in Elasticsearch which is very old and consume lot of spaces. data stored in APIMAN-METRICS is .cfs, .pos this type of form so how can i delete this type of data. it directly not shown in JSON format. How can i delete this?

---

<div class="post-metadata">

**Author:** ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)\
**Post date:** [March 2, 2022, 4:25am UTC](https://discuss.elastic.co/t/elasticsearch-index/298257/7 "2022-03-02T04:25:41Z")

</div>

> [@umangpatel](#):
>
> i want to remove APIMAN-METRICS in Elasticsearch which is very old and consume lot of spaces. data stored in APIMAN-METRICS is .cfs, .pos this type of form so how can i delete this type of data. it directly not shown in JSON format.

It's confusing. Isn't APIMAN-METRICS is a field of some index in your elasticsearch cluster? Why it is not shown and if it is not shown, how to specify the documents??

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [March 2, 2022, 5:08am UTC](https://discuss.elastic.co/t/elasticsearch-index/298257/8 "2022-03-02T05:08:47Z")

</div>

@umangpatel

Please run these in Kibana Dev Tools and share the output

`GET /`

`GET _cat/indices?v`

Then perhaps we can help.

---

<div class="post-metadata">

**Author:** ![umangpatel](https://avatars.discourse-cdn.com/v4/letter/u/3bc359/32.png) [@umangpatel](https://discuss.elastic.co/u/umangpatel)\
**Post date:** [March 2, 2022, 5:21am UTC](https://discuss.elastic.co/t/elasticsearch-index/298257/9 "2022-03-02T05:21:08Z")

</div>

Sorry, but We have using oldest version of kibana. And i can't see kibana dev tools in kibana dashboards. what's next step?

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [March 2, 2022, 6:18am UTC](https://discuss.elastic.co/t/elasticsearch-index/298257/10 "2022-03-02T06:18:02Z")

</div>

What version of Elasticsearch are you running?

The equivalent commands can be run using curl fro

`curl http://<elasticsearch hostname>:9200/`

etc that should show the version.

`curl http://<elasticsearch hostname>:9200/_cat/indices/?v`

---

<div class="post-metadata">

**Author:** ![umangpatel](https://avatars.discourse-cdn.com/v4/letter/u/3bc359/32.png) [@umangpatel](https://discuss.elastic.co/u/umangpatel)\
**Post date:** [March 2, 2022, 6:48am UTC](https://discuss.elastic.co/t/elasticsearch-index/298257/11 "2022-03-02T06:48:48Z")

</div>

We have using ES version 1.7.2

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [March 2, 2022, 7:03am UTC](https://discuss.elastic.co/t/elasticsearch-index/298257/12 "2022-03-02T07:03:22Z")

</div>

That is incredibly old and EOL and assuming there's any data of value in there, you should seriously consider upgrading.

Those commands should still work.

Run the \_cat indices and show us what the result is.

---

<div class="post-metadata">

**Author:** ![umangpatel](https://avatars.discourse-cdn.com/v4/letter/u/3bc359/32.png) [@umangpatel](https://discuss.elastic.co/u/umangpatel)\
**Post date:** [March 2, 2022, 8:22am UTC](https://discuss.elastic.co/t/elasticsearch-index/298257/13 "2022-03-02T08:22:47Z")

</div>

Pl find screenshot. Result of above command  
 ![indices](https://us1.discourse-cdn.com/elastic/original/3X/0/7/07ec916c8fd057db3c7cb17b0984f207c0c67a9c.png)

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [March 2, 2022, 2:28pm UTC](https://discuss.elastic.co/t/elasticsearch-index/298257/14 "2022-03-02T14:28:17Z")

</div>

A) Do want to completely **remove the entire apiman index** , completely remove it?

B) Or just certain documents from inside the apiman index an leave the rest of the documents?

---

<div class="post-metadata">

**Author:** ![umangpatel](https://avatars.discourse-cdn.com/v4/letter/u/3bc359/32.png) [@umangpatel](https://discuss.elastic.co/u/umangpatel)\
**Post date:** [March 3, 2022, 4:35am UTC](https://discuss.elastic.co/t/elasticsearch-index/298257/15 "2022-03-03T04:35:50Z")

</div>

No no, I want to remove just 6 months old documents inside apiman index. Not remove entire apiman index.

---

<div class="post-metadata">

**Author:** ![umangpatel](https://avatars.discourse-cdn.com/v4/letter/u/3bc359/32.png) [@umangpatel](https://discuss.elastic.co/u/umangpatel)\
**Post date:** [March 4, 2022, 4:48am UTC](https://discuss.elastic.co/t/elasticsearch-index/298257/16 "2022-03-04T04:48:42Z")

</div>

Any Update on this..

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [March 4, 2022, 5:20am UTC](https://discuss.elastic.co/t/elasticsearch-index/298257/17 "2022-03-04T05:20:13Z")

</div>

You will need to get the index back to green then use delete\_by\_query as suggested above... Only way to do what you want.

---

<div class="post-metadata">

**Author:** ![umangpatel](https://avatars.discourse-cdn.com/v4/letter/u/3bc359/32.png) [@umangpatel](https://discuss.elastic.co/u/umangpatel)\
**Post date:** [March 4, 2022, 5:32am UTC](https://discuss.elastic.co/t/elasticsearch-index/298257/18 "2022-03-04T05:32:18Z")

</div>

How to get the index back to green?

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [March 4, 2022, 6:43am UTC](https://discuss.elastic.co/t/elasticsearch-index/298257/19 "2022-03-04T06:43:09Z")

</div>

Good question...

Run

This

> **[cat health | Elasticsearch Guide \[1.7\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/1.7/cat-health.html#cat-health)**

And this

> **[cat shards | Elasticsearch Guide \[1.7\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/1.7/cat-shards.html#cat-shards)**

And show The full output in text not a screenshot and perhaps we can help.

---

<div class="post-metadata">

**Author:** ![umangpatel](https://avatars.discourse-cdn.com/v4/letter/u/3bc359/32.png) [@umangpatel](https://discuss.elastic.co/u/umangpatel)\
**Post date:** [March 4, 2022, 6:56am UTC](https://discuss.elastic.co/t/elasticsearch-index/298257/20 "2022-03-04T06:56:39Z")

</div>

OK, I will check and send a results to you

[Next page](https://discuss.elastic.co/t/elasticsearch-index/298257.md?page=2)
