I have an index of binary files created by fscrawler(has a default mapping).
I am querying my index using php-elasticsearch:
if ($q2 == '') {
$params = [
'index' => 'trial2',
'body' => [
'query' => [
'term' => [
'content' => $q
]
]
]
];
$query = $client->search($params);
$data['q'] = $q;
}
I am trying to do an exact full text search on the content field (body). how do i do it?
You probably need to change the default mapping and use a
keyword
data type for thecontent
field. That being said, it won't allow searching for individual terms anymore.Is that really what you want?
May be what you are after is actually using a
match
query instead of aterm
query?