kiwionly / elasticsearch-image

Content Based Image Retrieval Plugin for Elasticsearch. It allows users to index images and search for similar images.
Apache License 2.0
46 stars 20 forks source link

Mapper parsing exception and null pointers on indexing #14

Closed nickstanisha closed 8 years ago

nickstanisha commented 8 years ago

I've built and installed this release on Elasticsearch 2.3.3 using gradle, and I have gotten to the point where I'm trying to ingest an image:

curl -XPOST 'localhost:9200/test/test' -d '{
    "my_img": "blah blah blah..."
}'

and I am receiving this error

{
  "error" : {
    "root_cause" : [ {
      "type" : "mapper_parsing_exception",
      "reason" : "failed to parse"
    } ],
    "type" : "mapper_parsing_exception",
    "reason" : "failed to parse",
    "caused_by" : {
      "type" : "null_pointer_exception",
      "reason" : null
    }
  },
  "status" : 400
}

are there any instructions for fixing this? On kzwang's original branch, the solution was to downgrade to an older version of ES, but my plugin version matches my ES version so I'm not sure what the problem is.

kiwionly commented 8 years ago

hm.. I not sure the issue.

just make sure the following steps no error. 1) plugin install properly, 2) create index. 3) create mapping

then your can start index your image.

I had update the README, you can refer it to see if any thing missing.

nickstanisha commented 8 years ago

I think the plugin is installed properly-- I built the project with gradle and then unzipped the contents of the distribution to my plugins folder. Then, I created my index with the following command

curl -XPUT 'localhost:9200/test' -d '{
  "settings": {
    "number_of_shards": 5,
    "number_of_replicas": 1,
    "index.version.created": 1070499
  }
}'

and the mapping with this command

curl -XPUT 'localhost:9200/test/test/_mapping' -d '{
    "test": {
        "properties": {
            "my_img": {
                "type": "image",
                "feature": {
                    "CEDD": {
                        "hash": ["BIT_SAMPLING"]
                    },
                    "JCD": {
                        "hash": ["BIT_SAMPLING", "LSH"]
                    }
                },
                "metadata": {
                    "jpeg.image_width": {
                        "type": "string",
                        "store": "yes"
                    },
                    "jpeg.image_height": {
                        "type": "string",
                        "store": "yes"
                    }
                }
            }
        }
    }
}'

Both of these commands completed successfully, but now I get a mapper parsing exception when I try to index.

nickstanisha commented 8 years ago

False alarm: There was an error encoding the base64 string, and not an actual error with installation. If possible, it would be nice if the plugin could check for proper image formatting and return a more descriptive error if the image is not properly encoded. Thanks!