Can't index a document, getting an UnavailableShardsException


(Ittai Zeidman) #1

Hi,
I'm unable to index documents via the java api.
I've compiled a set of isolated steps with a gist containing all my files
to demonstrate my issue as I hope someone can point me to the error of my
ways (I've been struggling with this for hours).

  1. Unzip ES
  2. configure the cluster.name property (mycluster)
  3. configure the index.number_of_shards property (1)
  4. configure the index.number_of_replicas property (0)
  5. configure the network.host property (localhost)
  6. run elasticsearch/bin/elasticsearch.bat
  7. create an index from the commandline- curl -XPUT
    http://localhost:9200/test_index/
  8. create a mapping from the commandline- curl -XPUT
    http://localhost:9200/test_index/mytype/_mapping -d"at"mytypeJSONSchema.txt
  9. run the cluster health api call and see that there are no
    "unassigned_shards"- curl -XGET
    http://localhost:9200/_cluster/health?pretty=true
  10. run the simpleTest JUnit test and see that it throws an
    UnavailableShardsException
  11. run the curl -XPUT -d"at"mytype.json
    http://localhost:9200/test_index/mytype/1 and see that the document does go
    in

the "at" is because the group disallows "mails"
I've included in my gist https://gist.github.com/1678085 the following
files:

  1. elasticsearch.yml
  2. mycluster.log
  3. MyType.java
  4. mytype.json
  5. mytypeJSONSchema.txt
  6. SimpleTest.java
  7. stacktrace of test

I'd really appreciate help with this issue.

Thanks


(Shay Banon) #2

Again,

Does your node connects to the server? Use TransportClient and specifically add the address of the server you start, I think you have problem with multicast discovery on your machine. Lets work around that.

On Wednesday, January 25, 2012 at 9:43 PM, Ittai Zeidman wrote:

Hi,
I'm unable to index documents via the java api.
I've compiled a set of isolated steps with a gist containing all my files to demonstrate my issue as I hope someone can point me to the error of my ways (I've been struggling with this for hours).

  1. Unzip ES
  2. configure the cluster.name (http://cluster.name) property (mycluster)
  3. configure the index.number_of_shards property (1)
  4. configure the index.number_of_replicas property (0)
  5. configure the network.host property (localhost)
  6. run elasticsearch/bin/elasticsearch.bat
  7. create an index from the commandline- curl -XPUT http://localhost:9200/test_index/
  8. create a mapping from the commandline- curl -XPUT http://localhost:9200/test_index/mytype/_mapping -d"at"mytypeJSONSchema.txt
  9. run the cluster health api call and see that there are no "unassigned_shards"- curl -XGET http://localhost:9200/_cluster/health?pretty=true
  10. run the simpleTest JUnit test and see that it throws an UnavailableShardsException
  11. run the curl -XPUT -d"at"mytype.json http://localhost:9200/test_index/mytype/1 and see that the document does go in

the "at" is because the group disallows "mails"

I've included in my gist (https://gist.github.com/1678085) the following files:
elasticsearch.yml
mycluster.log
MyType.java
mytype.json
mytypeJSONSchema.txt
SimpleTest.java
stacktrace of test

I'd really appreciate help with this issue.

Thanks


(system) #3