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 elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/3969e1e5-6a19-461d-87d3-3f5c8fa021fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to