0

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?

dadoonet
  • 14,109
  • 3
  • 42
  • 49
Denn
  • 447
  • 1
  • 6
  • 27

1 Answers1

1

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?

dadoonet
  • 14,109
  • 3
  • 42
  • 49