Restrict suggestions to provide data from an desired index while using stored searches

We are using stored searches to perform queries, sort, agregations, and suggestions across a predefined index.

Previously, we were not able to restrict the sort to certain indexes, so when we do a sort it searched across all the indexes, and the index without having the sort field showed an error like below.

"reason": {
	"type": "illegal_argument_exception",
	"reason": "no mapping found for field [firstname]"
}

We looked through the documentation ( _index field | Elasticsearch Guide [7.15] | Elastic) and fixed it by passing the sort param (_index ) like below.

"sort": [
	{
		"_index": { 
	        "order": "asc"
	    },
		"firstname": {
			"order": "desc"
		}
	}
]

Similarly, we have suggestions configured in our stored search, however, we are not able to restrict them to the desired index. Is there any way to achieve the same on suggestions?

{
    "suggest": {
        "Suggestion": {
            "text": "*",
            "phrase": {
                "analyzer": "trigram",
                "field": "suggest_field",
                "size": 1,
                "real_word_error_likelihood": 0.95,
                "confidence": 1,
                "separator": " ",
                "max_errors": 4,
                "gram_size": 3,
                "force_unigrams": true,
                "token_limit": 10,
                "direct_generator": [
                    {
                        "field": "suggest_field",
                        "max_edits": 2,
                        "max_inspections": 5,
                        "max_term_freq": 0.01,
                        "min_word_length": 4,
                        "min_doc_freq": 5,
                        "prefix_length": 4,
                        "suggest_mode": "MISSING",
                        "size": 1
                    }
                ]
            }
        }
    }
}

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