I am trying to include Elastic search into my application. In a scenario a user can select field type and enter the searchable value.
Let say, Search using First Name and Value is 'ABC'
.
I have tried this using bool query,but How i can use 'more_like_this'
query method?.
This what I have done so far.
$searchParams['index'] = 'articles';
$searchParams['type'] = 'article';
$searchParams['body']['query']['match']['body'] = 'ABC';
$queryResponse = $es->search($searchParams);
but if i put more_like_this into the query field,data cannot be selected. any help please? Thanks in advance
This is the edited code
$searchParams['index'] = 'articles';
$searchParams['type'] = 'article';
$searchParams['body']['query']['more_like_this']['fields'] = array('body','title');
$searchParams['body']['query']['more_like_this']['like_text'] = $q;
$searchParams['body']['query']['more_like_this']['min_term_freq'] = 1;
$searchParams['body']['query']['more_like_this']['percent_terms_to_match'] = 1;
$searchParams['body']['query']['more_like_this']['min_doc_freq'] = 1;
Can you tell me what this lines for?
$searchParams['body']['query']['more_like_this']['min_term_freq'] = 1;
$searchParams['body']['query']['more_like_this']['percent_terms_to_match'] = 1;
$searchParams['body']['query']['more_like_this']['min_doc_freq'] = 1;