ES integration with couchdb on windows


(jason) #1

Hello everyone,

I installed elasticsearch and couchdb on Windows, and have followed
the instructions on their website:

http://www.elasticsearch.org/tutorials/2010/08/01/couchb-integration.html

I opened dos command prompt, and ran this command:

curl -XPUT 'http://couchdb-host:5984/testdb

and then:

cd /path/to/elasticsearch/

./bin/plugin -install river-couchdb

However, when I am running the comand below:

C:>curl -X PUT http://localhost:9200/_river/testdb/_meta -d
'{"type":"couchdb",
"couchdb":{"host":"localhost","port":
5984,"db":"testdb","filter":null}}'

I am getting the following exception:

{"error":"MapperParsingException[Failed to parse]; nested:
JsonParseException[Un
expected character (''' (code 39)): expected a valid value (number,
String, arra
y, object, 'true', 'false' or 'null')\n at [Source: [B@1f10cca; line: 1, column: 2]]; ","status":400}

If anyone had experience in working with ES in Windows environment,
can you please point out what I am doing wrong? I am completely new to
ElasticSearch and will appreciate your assistance.


(Dave Cottlehuber) #2

On 6 March 2011 23:18, eugene efurman@gmail.com wrote:

Hello everyone,

I installed elasticsearch and couchdb on Windows, and have followed
the instructions on their website:

http://www.elasticsearch.org/tutorials/2010/08/01/couchb-integration.html

I opened dos command prompt, and ran this command:

curl -XPUT 'http://couchdb-host:5984/testdb

and then:

cd /path/to/elasticsearch/

./bin/plugin -install river-couchdb

However, when I am running the comand below:

C:>curl -X PUT http://localhost:9200/_river/testdb/_meta -d
'{"type":"couchdb",
"couchdb":{"host":"localhost","port":
5984,"db":"testdb","filter":null}}'

I am getting the following exception:

{"error":"MapperParsingException[Failed to parse]; nested:
JsonParseException[Un
expected character (''' (code 39)): expected a valid value (number,
String, arra
y, object, 'true', 'false' or 'null')\n at [Source: [B@1f10cca; line: 1, column: 2]]; ","status":400}

If anyone had experience in working with ES in Windows environment,
can you please point out what I am doing wrong? I am completely new to
ElasticSearch and will appreciate your assistance.

Hi Eugene

Your quoting needs to be sorted out a la
http://wiki.apache.org/couchdb/Quirks_on_Windows it's not unix so
'{....}' doesn't get through the shell unmangled.

Put your json in a file foo.json:
{
"couchdb": {
"port": 5984,
"filter": null,
"db": "testdb",
"host": "localhost"
},
"type": "couchdb"
}

and try this instead:

curl --verbose --header "Content-Type: application/json" --data
@foo.json --request PUT http://localhost:9200/_river/testdb/_meta

The alternative is to use ^" but it gets really messy really quick.

BTW DOS is an 8 bit OS..... you're using the command shell now :wink:

In Figure 2.3, the command name describes the action to be performed,
while the arguments provide additional information needed to carry out
this action. The syntax of the command arguments is specific to each
command. However, there are a number of well-established conventions
for command argument syntax. These are only conventions, however, and
each individual command is free to interpret the supplied arguments
however it chooses:

First, multiple arguments are normally separated from one another

by spaces. In Figure 2.3, the command has three arguments, c:*.bak,
e:\backup, and /s. Occasionally, other characters are used as argument
separators. For example, the COPY command can use + characters to
separate multiple filenames.

Second, any argument that contains spaces or begins or ends with

spaces must be enclosed in double quotes. This is particularly
important when using long file and directory names, which frequently
contain one or more spaces. If a double-quoted argument itself
contains a double quote character, the double quote must be doubled.
For example, enter "Quoted" Argument as """Quoted"" Argument".

Third, command switches always begin with a slash / character. A

switch is an argument that modifies the operation of the command in
some way. Occasionally, switches begin with a + or - character. Some
switches are global, and affect the command regardless of their
position in the argument list. Other switches are local, and affect
specific arguments (such as the one immediately preceding the switch).

Fourth, all reserved shell characters not in double quotes must be

escaped. These characters have special meaning to the Windows NT
command shell. The reserved shell characters are:

& | ( ) < > ^

To pass reserved shell characters as part of an argument for a

command, either the entire argument must be enclosed in double quotes,
or the reserved character must be escaped. Prefix a reserved character
with a carat (^) character to escape it. For example, the following
command example will not work as expected, because < and > are
reserved shell characters:

1. C:\>echo <dir>
 2. The syntax of the command is incorrect.

Instead, escape the two reserved characters, as follows:

1. C:\>echo ^<dir^>
 2. <dir>

Typically, the reserved shell characters are not used in commands,

so collisions that require the use of escapes are rare. They do occur,
however. For example, the popular PKZIP program supports a -& switch
to enable disk spanning. To use this switch correctly under Windows
NT, -^& must be typed.

Tip The carat character is itself a reserved shell character.

Thus, to type a carat character as part of a command argument, type
two carats instead. Escaping is necessary only when the normal shell
interpretation of reserved characters must be bypassed.

Finally, the maximum allowed length of a shell command appears to

be undocumented by Microsoft. Simple testing shows that the Windows NT
command shell allows very long commands—in excess of 4,000 characters.
Practically speaking, there is no significant upper limit to the
length of a command.

[from http://technet.microsoft.com/en-us/library/cc723564.aspx]

Cheers
Dave


(jason) #3

Dave,

Thank you very much. Your command worked!

Now I would like to be able to test service request using ES. In my
command shell, I am running:

curl -X GET http://localhost:9200/testdb

and getting the error below:

No handler found for uri [/testdb] and method [GET]

Am I still missing something, or I have to provide different url? Thank you
in advance.

-Eugene.

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/ES-integration-with-couchdb-on-windows-tp2641279p2642719.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(jason) #4

Dave,

Thank you very much. Your command worked!

Now I would like to be able to test service request using ES. In my
command shell, I am running:

curl -X GET http://localhost:9200/testdb

and getting the error below:

No handler found for uri [/testdb] and method [GET]

Am I still missing something, or I have to provide different url? Thank you
in advance.

-Eugene.

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/ES-integration-with-couchdb-on-windows-tp2641279p2642905.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(jason) #5

Dave,

Thank you very much. Your command worked!

Now I would like to be able to test service request using ES. In my
command shell, I am running:

curl -X GET http://localhost:9200/testdb

and getting the error below:

No handler found for uri [/testdb] and method [GET]

Am I still missing something, or I have to provide different url? Thank you
in advance.

-Eugene.

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/ES-integration-with-couchdb-on-windows-tp2641279p2642908.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(jason) #6

Dave,

Thank you very much. Your command worked!

Now I would like to be able to test service request using ES. In my
shell command, I am running:

curl -X GET http://localhost:9200/testdb

and getting the error below:

No handler found for uri [/testdb] and method [GET]

Am I still missing something, or I have to provide different url?
Thank you in advance.

-Eugene.


(system) #7