Creating an Index via Java API and JSON String


(dlpatri) #1

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.


(system) #2