简体   繁体   English

有没有办法在一个索引上有多个完成建议?

[英]Is there a way to have multiple completion suggesters on a single index?

Here is my index: 这是我的索引:

{
"mappings": {
    "packages" : {
        "properties" : {
            "suggest-name" : {
                "type" : "completion"
            },
            "suggest-tags" : {
                "type" : "completion"
            },
            "suggest-cmdlets" : {
                "type" : "completion"
            }
        }
    }
}
}

I would love to be able to something like this: 我希望能够实现以下功能:

curl -XPOST 'localhost:32769/test/_search?pretty&pretty' -H 'Content-Type: application/json' -d'
{
    "suggest": {
        "packages-suggest" : {
            "prefix" : "get",
            "completion" : {
                "fields" : ["suggest-cmdlet", "suggest-name", "suggest-tags"]
            }
        }
    }
}
'

and specify all the fields I want to try to look at for the autocomplete. 并指定要尝试查看自动填充功能的所有字段。

This doesn't seem to be the right way to do it... How would you reference multiple fields in an autocomplete search query? 这似乎不是正确的方法...您将如何在自动完成的搜索查询中引用多个字段?

Thanks for the help! 谢谢您的帮助!

You need to do it like this: 您需要这样做:

curl -XPOST 'localhost:32769/test/_search?pretty&pretty' -H 'Content-Type: application/json' -d'
{
    "suggest": {
        "packages-suggest-1" : {
            "prefix" : "get",
            "completion" : {
                "field" : "suggest-cmdlets"
            }
        },
        "packages-suggest-2" : {
            "prefix" : "get",
            "completion" : {
                "field" : "suggest-name"
            }
        },
        "packages-suggest-3" : {
            "prefix" : "get",
            "completion" : {
                "field" : "suggest-tags"
            }
        }
    }
}
'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Java API在Elasticsearch中使用完成建议查询 - Querying with Completion Suggesters in Elasticsearch with Java API 在ElasticSearch中,我必须创建单个索引和多个类型还是使用单个类型的多个索引? - In ElasticSearch i have to create single index and multiple types or multiple index with single types? 单索引或多索引 - Single index or multiple index 建议在索引中跨多个类型完成 - suggestion completion across multiple types in an index 具有稀疏字段的单个_type是否对索引具有与多种类型(在ElasticSearch中)相同的索引? - Does a single _type with sparse fields have the same effect on the index as multiple types (in ElasticSearch)? Elasticsearch Completion Suggester 忽略 Index 参数并返回多个索引的结果 - Elasticsearch Completion Suggester ignores Index parameter and returns results for multiple indices elasticsearch:单个索引中的多种类型 - elasticsearch: multiple types in a single index 对多个索引进行搜索的建议给出了“ ElasticsearchException [Field []不是完成建议字段]” - Suggest with search on multiple index gives “ElasticsearchException[Field [] is not a completion suggest field]” ElasticSearch在单个索引中具有相同映射的多种类型 - ElasticSearch multiple types with same mapping in single index Elasticsearch 跨多个索引的单一分析仪 - Elasticsearch Single analyzer across multiple index
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM