【问题标题】:Running an exact phrase match against all fields under multiple indexes in ElasticSearch对 ElasticSearch 中多个索引下的所有字段运行完全匹配的短语
【发布时间】:2015-11-23 14:46:38
【问题描述】:

我需要对多个索引下的所有字段进行完全匹配。

弹性java api有一个方法matchPhaseQuery

/**
     * Creates a text query with type "PHRASE" for the provided field name and text.
     *
     * @param name The field name.
     * @param text The query text (to be analyzed).
     */
    public static MatchQueryBuilder matchPhraseQuery(String name, Object text) {
        return new MatchQueryBuilder(name, text).type(MatchQueryBuilder.Type.PHRASE);
    }

问题是它需要字段名称来运行匹配短语查询。 而我需要针对多个索引下的所有字段运行。

有什么办法可以做到吗?

【问题讨论】:

    标签: java elasticsearch


    【解决方案1】:

    在匹配阶段查询方法中,字段名称将

    “_全部”

    matchPhraseQuery("_all", Object text){}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-02
      • 1970-01-01
      • 2022-12-10
      • 2018-04-21
      • 2020-11-02
      • 1970-01-01
      相关资源
      最近更新 更多