I've recently started using ElasticSearch and I can't seem to make it search for a part of a word.
Example: I have three documents from my couchdb indexed in ElasticSearch:
{
"_id" : "1",
"name" : "John Doeman",
"function" : "Janitor"
}
{
"_id" : "2",
"name" : "Jane Doewoman",
"function" : "Teacher"
}
{
"_id" : "3",
"name" : "Jimmy Jackal",
"function" : "Student"
}
So now, I want to search for all documents containing "Doe"
curl http://localhost:9200/my_idx/my_type/_search?q=Doe
That doesn't return any hits. But if I search for
curl http://localhost:9200/my_idx/my_type/_search?q=Doeman
It does return one document (John Doeman).
Am trying with this url http://localhost/el/index.php?str=*doe*
.
<?php
require 'vendor/autoload.php';
$client = Elasticsearch\ClientBuilder::create()->build();
$params = array();
$params['index'] = 's3';
$params['type'] = 's3files';
$params['body']['query']['match']['content'] = $_GET['str'];
$result = $client->search($params);
echo "<pre>";
print_r($result);
How can I make ElasticSearch find both John Doeman and Jane Doewoman when I search for "Doe" ?