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 do you reference multiple fields in an autocomplete search query?

Thanks for the help!

I ended up using this:

{
    "suggest": {
        "packages-suggest-cmdlets" : {
            "prefix" : "az",
            "completion" : {
                "field" : "suggest-cmdlets"
            }
        },
        "packages-suggest-name" : {
            "prefix" : "az",
            "completion" : {
                "field" : "suggest-name"
            }
        },
        "packages-suggest-tags" : {
            "prefix" : "az",
            "completion" : {
                "field" : "suggest-tags"
            }
        }
    }
}
1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.