$params2 =array();
$params2['body']['query']['text']['file'] = 'my words';
$params2['body']['highlight']['fields']['file'] = array("term_vector" =>
"with_positions_offsets");
$results = $client->search($params2);
print_r($results);
"search" does not work...
*Result raising error like below.* please help. Give correct solution.
Thanks in advance.
PHP Fatal error: Uncaught exception
'Guzzle\Http\Exception\ClientErrorResponseException' with message 'Client
error response
[status code] 400
[reason phrase] Bad Request
[url] http://localhost:9200/_search' in
/var/www/html/magento/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/BadResponseException.php:43
Stack trace:
#0
/var/www/html/magento/vendor/guzzle/guzzle/src/Guzzle/Http/Message/Request.php(145):
Guzzle\Http\Exception\BadResponseException::factory(Object(Guzzle\Http\Message\EntityEnclosingRequest),
Object(Guzzle\Http\Message\Response))
#1 [internal function]:
Guzzle\Http\Message\Request::onRequestError(Object(Guzzle\Common\Event),
'request.error', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#2
/var/www/html/magento/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php(164):
call_user_func(Array, Object(Guzzle\Common\Event), 'request.error',
Object(Symfony\Component\EventDispatcher\EventDispatcher))
#3 /var/www/html/magento/vendor/symfony/event-dispatcher/Symfony/Componen
in
/var/www/html/magento/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php
on line 266
On Tuesday, 8 April 2014 15:50:45 UTC+5:30, Tanguy Bernard wrote:
>
> I find the answer :
>
> $params2 =array();
>
> $params2['body']['query']['text']['file'] = 'my words';
> $params2['body']['highlight']['fields']['file'] = array("term_vector" =>
> "with_positions_offsets");
> $results = $client->search($params2);
> print_r($results);
>
>
> Le mardi 8 avril 2014 10:22:21 UTC+2, Tanguy Bernard a écrit :
>>
>> Hello,
>> Recently, I find a very helpfull information here :
>> https://gist.github.com/lukas-vlcek/1075067
>>
>> I would like to reproduce the same indexing and searching with php
>> ElasticSearch client.
>> My indexing seems to work!
>>
>> <?php
>> require_once 'vendor/autoload.php';
>> $client = new Elasticsearch\Client();
>>
>> $doc_src = "fn6742.pdf";
>> $binary = fread(fopen($doc_src, "r"), filesize($doc_src));
>> $doc_str = base64_encode($binary);
>>
>>
>> $article = array();
>> $article['index'] = 'index2';
>> $article['type'] = 'attachment';
>> $article['body'] = array('file' => $doc_str);
>>
>> $result = $client->index($article);
>>
>> ?>
>>
>>
>> But my "search" does not work. I would like to find the sentence where my
>> world is.
>> I tried this :
>>
>> $params2['body']['query']['match']['file'] = 'my word';
>> $results = $client->search($params2);
>> print_r($results);
>>
>> And I would like something like this : "file" : [ " It's<em>my word</em>
>> /You can't use <em>my word</em> / because " ]
>>
>>
>> I hope you can help me?
>>
>> Thanks in advance
>>
>>
--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/78b4cad8-6b23-4dea-a1cc-15c8ca7cdaa0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.