I used bulk api with php, but met a problem:
{"error":"Failed to derive xcontent from
org.elasticsearch.common.bytes.ChannelBufferBytesReference
here is my curl command:
curl -s -XPOST localhost:9200/_bulk --data-binary @requests;
php code:
<?php $method = "POST"; $url = "http://localhost/_bulk"; $data = array('file' => '@requests'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_PORT, 9200); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($method)); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $result = curl_exec($ch); curl_close($ch); print_r($result); --