$data='{"keyword":"halo"}';
$elasticsearch->add($id,$data);
below are the format echoed from the php ES class code
file_get_contents(
http://localhost:9200/putusan/ma/8b076cb020b8bf19bc4aab8583bb080b, NULL,
stream_context_create(array('http' => Array))))
where the *Array *contains
array(2) { ["method"]=> string(3) "PUT" ["content"]=> string(18)
"{"keyword":"halo"}" }
On Tue, Jul 6, 2010 at 9:16 PM, Clinton Gormley clinton@iannounce.co.ukwrote:
Can you provide the actual PUT request that you used?
It is likely that the syntax is wrong.
ta
clint
On Tue, 2010-07-06 at 07:14 -0700, Chenri wrote:
Also in the log I found this
[20:39:07,750][DEBUG][action.index ] [van Lunt, Cornelius]
[putusan][3], Node[6202ffed-7ae8-4ad3-85b2-6ccd3c126925], [P],
S[STARTED]: Failed to execute [[putusan][ma][1],
source['{keyword:data}']]
org.elasticsearch.index.mapper.MapperParsingException: Failed to parse
at
org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper.parse(XContentDocumentMapper.java:
- at
org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper.parse(XContentDocumentMapper.java:
- at
org.elasticsearch.index.shard.service.InternalIndexShard.innerIndex(InternalIndexShard.java:
- at
org.elasticsearch.index.shard.service.InternalIndexShard.index(InternalIndexShard.java:
- at
org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:
- at
org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:
- at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:
- at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction.access
$400(TransportShardReplicationOperationAction.java:198)
at
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction
$AsyncShardOperationAction
$1.run(TransportShardReplicationOperationAction.java:252)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.elasticsearch.util.jackson.JsonParseException:
Unexpected character (''' (code 39)): expected a valid value (number,
String, array, object, 'true', 'false' or 'null')
at [Source: [B@b206e9; line: 1, column: 2]
at
org.elasticsearch.util.jackson.JsonParser._constructError(JsonParser.java:
- at
org.elasticsearch.util.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:
- at
org.elasticsearch.util.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:
- at
org.elasticsearch.util.jackson.impl.Utf8StreamParser._handleUnexpectedValue(Utf8StreamParser.java:
- at
org.elasticsearch.util.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:
- at
org.elasticsearch.util.xcontent.json.JsonXContentParser.nextToken(JsonXContentParser.java:
- at
org.elasticsearch.index.mapper.xcontent.XContentDocumentMapper.parse(XContentDocumentMapper.java:
- ... 11 more
On Jul 6, 9:09 pm, Chenri chenrij...@gmail.com wrote:
I'm trying to setup ES in WinXP box using the PHP class from
herehttp://hublog.hubmed.org/archives/001907.html
For all the method with GET (query , check status, etc) it worked but
when using PUT (creating index) it produced the following error
===========================http://localhost:9200/putusan/array(1) {
["method"]=> string(3)
"PUT" }
A PHP Error was encountered
Severity: Warning
Message: file_get_contents(http://localhost:9200/putusan/)
[function.file-get-contents]: failed to open stream: HTTP request
failed! HTTP/1.0 400 Bad Request
Filename: libraries/Elasticsearch.php
Line Number: 15
What I don't understand is how come the get method worked but not with
the PUT method
I've also tried installing curl and run it in command prompt and I got
the same result
the GET method for Status and Query worked, but not with the PUT.
Is this something with the ES or just with the PHP or CURL issue?
Anyone can shed some light about this?
--
Web Announcements Limited is a company registered in England and Wales,
with company number 05608868, with registered address at 10 Arvon Road,
London, N5 1PR.
--
Chenri J
Mutiara Taman Palem H2-3
Mobile Phone: (62) (813) 152 05 949