# Reindex to change type with wildcard indexes

**URL:** <https://discuss.elastic.co/t/reindex-to-change-type-with-wildcard-indexes/78374>\
**Category:** Logstash\
**Created:** [March 13, 2017, 3:29pm UTC](https://discuss.elastic.co/t/reindex-to-change-type-with-wildcard-indexes/78374 "2017-03-13T15:29:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![p\_kc](https://avatars.discourse-cdn.com/v4/letter/p/8c91f0/32.png) [@p\_kc](https://discuss.elastic.co/u/p_kc)\
**Post date:** [March 13, 2017, 3:29pm UTC](https://discuss.elastic.co/t/reindex-to-change-type-with-wildcard-indexes/78374/1 "2017-03-13T15:29:59Z")

</div>

Hello,

When I started to send data from logstash to elasticsearch the format was set to string for several inputs.  
I'd like to change the format from string to integer, but it looks like it requires reindexing the whole stuff.

So I started to search how to reindex my logstash-\* to logstashnew-\* and change the format of some data from string to integer. (for the fields labelled "crsscore", "sentbyte", "rcvdbyte", "sentpkt" and "rcvdpkt").

All the examples I found so far use logstash with a single index.

Is it possible to process all indexes using a wildcard in the logstash input to be able to convert the format from string to integer when creating the new one ?

```
input {
  elasticsearch {
   hosts => "elasticsearch:9200"
   index => "logstash-*"
   size => 10
  }
}
filter {
  convert {
       "sentbyte" =>"integer"
       "sentpkt" =>"integer"
       "rcvdbyte" =>"integer"
       "rcvdpkt" =>"integer"
       "crsscore" =>"integer"
 }
}
output {
 elasticsearch {
   host => "elasticsearch.net"
   port => 9200
   protocol => "http"
   manage_template => false
   index => "logconvert-"
   document_id => "%{id}"
   workers => 1
 }
}

```

Best regards.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 13, 2017, 8:07pm UTC](https://discuss.elastic.co/t/reindex-to-change-type-with-wildcard-indexes/78374/2 "2017-03-13T20:07:13Z")

</div>

Hey,

this might be more of a logstash and not an Elasticsearch question.

You might want to check the [docinfo](https://www.elastic.co/guide/en/logstash/5.2/plugins-inputs-elasticsearch.html#plugins-inputs-elasticsearch-docinfo) configuration in the Elasticsearch input, it even contains an example.

--Alex

---

<div class="post-metadata">

**Author:** ![p\_kc](https://avatars.discourse-cdn.com/v4/letter/p/8c91f0/32.png) [@p\_kc](https://discuss.elastic.co/u/p_kc)\
**Post date:** [March 14, 2017, 7:46am UTC](https://discuss.elastic.co/t/reindex-to-change-type-with-wildcard-indexes/78374/3 "2017-03-14T07:46:00Z")

</div>

Thanks for the hint, but I still have an error with docinfo.  
08:42:12.345 [[main]\<elasticsearch] ERROR logstash.pipeline - A plugin had an unrecoverable error. Will restart this plugin.  
Plugin: \<LogStash::Inputs::Elasticsearch hosts=\>["[elasticsearch-srv.europa.net](http://elasticsearch-srv.europa.net)"], index=\>"logstash-2017.02.02", query=\>"\*", docinfo=\>true, id=\>"d0a8a12677067754d1a5d6720046586bafd939db-1", enable\_metric=\>true, codec=\>\<LogStash::Codecs::JSON id=\>"json\_eef2e278-5651-4e5f-9dce-aa96ff2a7137", enable\_metric=\>true, charset=\>"UTF-8"\>, size=\>1000, scroll=\>"1m", docinfo\_target=\>"@metadata", docinfo\_fields=\>["\_index", "\_type", "\_id"], ssl=\>false\>  
Error: [400] {"error":{"root\_cause":[{"type":"parse\_exception","reason":"Failed to derive xcontent"}],"type":"parse\_exception","reason":"Failed to derive xcontent"},"status":400}

I'm still stuck with my reindexing attempt.

Best regards.

---

<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:** [April 11, 2017, 7:46am UTC](https://discuss.elastic.co/t/reindex-to-change-type-with-wildcard-indexes/78374/4 "2017-04-11T07:46:20Z")

</div>

Closed on April 11, 2017, 7:46am UTC

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