P
P
PadreRv2015-04-21 17:15:38
elasticsearch
PadreRv, 2015-04-21 17:15:38

Correct search query in elasticsearch?

Please help with the request, there are names and a simple request for them

$request = array(
"from" => 0,
"size"=>1000000,
"query"=> array(
"match"=>array(
"full_description"=>array(
"query"=>$text,
"fuzziness "=> 2,
"prefix_length"=> 1,
)
)
);

but when you drive in Ivanov, it gives out Ivantsov first, then Ivanov, and only then everything else. Why is Ivantsov's _score higher than Ivanov's? I tried analyzers, well, I have the following code:
Creating an index
$request = array(
"mappings"=> array(
"person"=>array(
"properties"=>array(
"id"=>array(
"type"=> "integer",
"index"=> "not_analyzed"
),
"updated"=>array(
"type"=> "date",
"index"=> "not_analyzed"
),
"full_description"=>array(
"type"=> "string"
)
)
)
));

fetching from database with jdbc plugin
$request = array("type" => "jdbc",
"jdbc"=>array(
"url" => "jdbc:mysql://localhost:3306/test_m",
"user" => "user",
" password" => "pass",
"sql" => "SELECT id, updated, full_description FROM product_info",
"index"=>"index1",
"type"=>"person"
),
"analysis"=>array(
"analyzer"=> "english"
)
);

Search what is comical I already tried, nothing helps:
$request = array(
"from" => 0,
"size"=>1000000,
"query"=> array(
//"match_all"=>array(""=>""),
"match"=>array(
"full_description"=>array(
//"query"=> mb_convert_encoding($text, "utf-8", "CP1251"), //Encoding crap, elastic accepts utf-8
"query"=>$text,
" fuzziness"=> 2,
"prefix_length"=> 1,
//"min_similarity"=> "0.5"
)
)/*,
"order"=>array(
"max_score"=> "desc"
)*/
)/*,
"analysis"=>array(
"analyzer"=> "english"
)*/
/*,
"sort"=>array(
"updated"=>array(
"order"=>"desc",
"ignore_unmapped " => "true"
)
)*/
);

Help good people, I think to create a multi-query, the first one by the exact value, and the second one is Fusines 2, will the results be repeated?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
U
un1t, 2015-04-22
@un1t

If I understand correctly, you just use stemming. Need morphology, here is the plugin
https://github.com/imotov/elasticsearch-analysis-m...

P
PadreRv, 2015-04-28
@PadreRv

Everyone is on stackoverflows, they told me the reason, I decide, I write a function ru.stackoverflow.com/questions/418469/%D0%9D%D0%B5...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question