在弹性搜索中使用*(asterix)作为术语查询

时间:2015-05-03 21:19:04

标签: php elasticsearch lucene

我有一个带有'*'

标签的文档

然而,当我构造一个术语查询时,它不会返回任何结果。如何使用标记'*'查询文档。我猜这是一个需要逃脱的特殊角色。

以答案更新

我需要将属性设置为不进行分析,以便弹性搜索不会删除标点符号等。

$myTypeMapping = array(
    '_source' => array(
        'enabled' => true
    ),
    'properties' => array(
        'tag' => array("type" => "string", "index" => "not_analyzed")
    )
);
$indexParams['body']['mappings']['file'] = $myTypeMapping;

1 个答案:

答案 0 :(得分:2)

如果分析了您的curl -XGET 'localhost:9200/_analyze?analyzer=standard' -d '*' 字段,则该星标未编入索引。亲眼看看:

{"tokens":[]}

响应:

1) Right Click on the Database name in SSMS
2) Choose 'Tasks'
3) Click on 'Export Data'
4) Choose SQL Server Native Client for the Source Data and choose the database that containts the data to export
5) Choose Flat File for destination.
6) Follow the rest of the GUI....
4) Follow the Gui to export data

您需要将字段更改为not_analyzed或更改分析器。

相关问题