How do I map an index created by fscrawler so that I can do exact full text search on the document?

137 Views Asked by At

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?

1

There are 1 best solutions below

0
On

You probably need to change the default mapping and use a keyword data type for the content 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 a term query?