If search is not working. Change this line
*$params2['body']['query']['text']['file'*] *= 'my words';* as
*$params2['body']['query']['match']['file']
= 'my words'; *
$params2 =array();
$params2['body']['query']['match']['file'] = 'my words';
$params2['body']['highlight']['fields']['file'] = array("term_vector" =>
"with_positions_offsets");
$results = $client->search($params2);
print_r($results);
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/c8f2a7cf-8474-430b-a72f-701916909af2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.