# Creating an Index via Java API and JSON String

**URL:** <https://discuss.elastic.co/t/creating-an-index-via-java-api-and-json-string/5722>\
**Category:** Elasticsearch\
**Created:** [October 29, 2011, 7:34pm UTC](https://discuss.elastic.co/t/creating-an-index-via-java-api-and-json-string/5722 "2011-10-29T19:34:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dlpatri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dlpatri/32/3093_2.png) [@dlpatri](https://discuss.elastic.co/u/dlpatri)\
**Post date:** [October 29, 2011, 7:34pm UTC](https://discuss.elastic.co/t/creating-an-index-via-java-api-and-json-string/5722/1 "2011-10-29T19:34:20Z")

</div>

Hi guys,

I'm trying to use the Java API to help embed ElasticSearch in my tests. I'm seem to be getting stuck with setting the "settings" on the index. I have a JSON String:

```
{
  "settings":{
    "index":{
      "number_of_replicas":0,
      "number_of_shards":1,
      "store.fs.memory.enabled":true,
      "store.type":"memory"
    }
  }
}
```

And I'm basically calling:

```
ciReq = createIndexRequest(index.name)
  .settings(index.settings) //JSON String as shown above

return idxClient.create(ciReq).actionGet().acknowledged()
```

I've tried the JSON in a number of formats based on examples that I've seen. But nothing seems to have an effect on the created index. The logs always come back with something like this:

```
... [Oddball] creating Index [myindex], shards [5]/[1]
```

And the index is not in-memory.

Any help would be much appreciated.  
Thanks.

---

<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:50am UTC](https://discuss.elastic.co/t/creating-an-index-via-java-api-and-json-string/5722/2 "2017-07-06T03:50:30Z")

</div>


