# .StringIndexOutOfBoundsException: String index out of range: -1

**URL:** <https://discuss.elastic.co/t/stringindexoutofboundsexception-string-index-out-of-range-1/8490>\
**Category:** Elasticsearch\
**Created:** [July 23, 2012, 2:35pm UTC](https://discuss.elastic.co/t/stringindexoutofboundsexception-string-index-out-of-range-1/8490 "2012-07-23T14:35:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ABC](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@ABC](https://discuss.elastic.co/u/ABC)\
**Post date:** [July 23, 2012, 2:35pm UTC](https://discuss.elastic.co/t/stringindexoutofboundsexception-string-index-out-of-range-1/8490/1 "2012-07-23T14:35:14Z")

</div>

Hi,

I am a newbie to elasticsearch. Does anyone know any reasons for this  
exception while indexing data.

_"Caused by: java.lang.StringIndexOutOfBoundsException: String index out of  
range: -1_

- 

```
   at java.lang.String.substring(String.java:1937)*

```

- 

```
   at 

```

org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.addMappings(MetaDataCreateIndexService.java:355)  
\*

- 

```
   at 

```

org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.access$500(MetaDataCreateIndexService.java:81)"  
\*

---

<div class="post-metadata">

**Author:** ![uboness1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/uboness1/32/849_2.png) [@uboness1](https://discuss.elastic.co/u/uboness1)\
**Post date:** [July 23, 2012, 6:52pm UTC](https://discuss.elastic.co/t/stringindexoutofboundsexception-string-index-out-of-range-1/8490/2 "2012-07-23T18:52:35Z")

</div>

Hi,

Looks like formatting of the mapping settings. Would be helpful if you also paste the settings.

Cheers,  
Uri

--  
Uri Boness | Founder | Elasticsearch | [www.elasticsearch.com](http://www.elasticsearch.com) | +31 20 486 2036

On Monday, July 23, 2012 at 4:35 PM, ABC wrote:

> Hi,
> 
> I am a newbie to elasticsearch. Does anyone know any reasons for this exception while indexing data.
> 
> "Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1  
> at java.lang.String.substring(String.java:1937)  
> at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.addMappings(MetaDataCreateIndexService.java:355)  
> at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.access$500(MetaDataCreateIndexService.java:81)"

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [July 24, 2012, 5:04pm UTC](https://discuss.elastic.co/t/stringindexoutofboundsexception-string-index-out-of-range-1/8490/3 "2012-07-24T17:04:08Z")

</div>

ABC,

Check config/mappings/\_default and config/mappings/_YOUR-INDEX-NAME_directories, if you see any files there without an extension - rename them  
to have an extension (.json, for example).

Igor

On Monday, July 23, 2012 2:52:35 PM UTC-4, uboness wrote:

> Hi,
> 
> Looks like formatting of the mapping settings. Would be helpful if you  
> also paste the settings.
> 
> Cheers,  
> Uri
> 
> --  
> Uri Boness | Founder | Elasticsearch | [www.elasticsearch.com](http://www.elasticsearch.com) | +31 20 486  
> 2036
> 
> On Monday, July 23, 2012 at 4:35 PM, ABC wrote:
> 
> Hi,
> 
> I am a newbie to elasticsearch. Does anyone know any reasons for this  
> exception while indexing data.
> 
> _"Caused by: java.lang.StringIndexOutOfBoundsException: String index out  
> of range: -1_
> 
> - 
> 
> ```
> at java.lang.String.substring(String.java:1937)*
> 
> ```
> 
> - 
> 
> ```
> at 
> 
> ```
> 
> org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.addMappings(MetaDataCreateIndexService.java:355)  
> \*
> 
> - 
> 
> ```
> at 
> 
> ```
> 
> org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.access$500(MetaDataCreateIndexService.java:81)"  
> \*

---

<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:** [July 6, 2017, 3:19am UTC](https://discuss.elastic.co/t/stringindexoutofboundsexception-string-index-out-of-range-1/8490/4 "2017-07-06T03:19:15Z")

</div>


