【问题标题】:How do I map an index created by fscrawler so that I can do exact full text search on the document?如何映射由 fscrawler 创建的索引,以便对文档进行精确的全文搜索?
【发布时间】:2020-03-01 20:22:29
【问题描述】:

我有一个由 fscrawler 创建的二进制文件的索引(具有默认映射)。

我正在使用 php-elasticsearch 查询我的索引:

if ($q2 == '') {
  $params = [
    'index' => 'trial2',
    'body' => [
       'query' => [
        'term' => [
          'content' => $q
              ]
        ]
    ]
];

$query = $client->search($params);
$data['q'] = $q;
}

我正在尝试对内容字段(正文)进行精确的全文搜索。我该怎么做?

【问题讨论】:

    标签: php elasticsearch fscrawler


    【解决方案1】:

    您可能需要更改默认映射并为content 字段使用keyword 数据类型。话虽如此,它不再允许搜索单个术语。

    这真的是你想要的吗?

    可能您实际使用的是match 查询而不是term 查询?

    【讨论】:

      猜你喜欢
      • 2017-09-14
      • 1970-01-01
      • 1970-01-01
      • 2011-03-20
      • 1970-01-01
      • 2015-09-21
      • 2012-03-23
      • 2014-09-24
      • 2021-11-13
      相关资源
      最近更新 更多