Alex's Elasticsearch Adventure

From CoGepedia
Revision as of 16:33, 22 September 2014 by Franka1 (Talk | contribs)

Jump to: navigation, search

I have been working on getting a working Elasticsearch database populated with test data, in order to see what the system is capable of.

First, I went through all the steps at https://genomevolution.org/wiki/index.php/Install_Elasticsearch.

Next, I began looking into loading multiple JSON objects into Elasticsearch's system at once. Found useful information at http://httpkit.com/resources/HTTP-from-the-Command-Line/ under the heading "Use a File as a Request Body".

I created a JSON file (I called it sample1.json) that looked like this:

{

1: { id: 1, type_name: "gene", start: 0, stop: 1, strand: "+", chromosome: 1 feature_name: { name1: "blah1", name2: "name", name3: "George", name4: "obligatory" } },

2: { id: 2,

       	type_name: "exon",

start: 1776, stop: 2014, strand: "und", chromosome: 3 feature_name: { name1: "stuff", name2: "at4g37764", name3: "578926", name4: "name_of_feature" } },

3: {

               id: 3,
               type_name: "cds",
               start: 1,
               stop: 4,
               strand: "-",
               chromosome: 2
               feature_name: {
                       name1: "stuff",
                       name2: "at4g37764",
                       name3: "578926",
               }
       }
}


I then tested the command

curl -X PUT \
    -H 'Content-Type: application/json' \
    -d @sample1.json \
    localhost:9200/testIndex/feature

and got a "No handler Found" error.

So, I tried reorganizing the command:

curl -XPUT localhost:9200/testIndex/feature -H 'Content-Type: application/json' -d @sample1.json

Same error:

No handler found for uri [/testIndex/feature] and method [PUT]franka1@172:~$