Source filtering ONLY on suggestions

It seems very odd that source filtering is only allowed at the root of the _search request. This should be legal:

{
    "suggest": {
    	"text": "A cool titl",
        "typeahead-suggest" : {
            "completion" : {
                "_source": false,
               // STUFF
            }
        }
    }
}

The reason being that typeahead suggestions are likely going to be used as a fallback for a standard search & phrase-suggest like so:

{
    "query": {
        // STUFF
    },
	"suggest": {
		"text": "A cool titl",
		"typeahead-suggest" : {
			"completion" : { 
				"field" : "typeahead",
				"size": 5,
				"fuzzy": {
					"fuzziness": 2
				}
			}
		},
		"phrase-suggest": {
		  "phrase": {
			"field": "suggestions",
			"size": 5,
			"highlight": {
			  "pre_tag": "<em>",
			  "post_tag": "</em>"
			}
		  }
	   }
	}
}

As with SOLR, this is often useful so that the client does not have to make a second request when there are no search hits. First, we fall back on phrase suggestions, and finally on typahead suggestions as a last resort (they use somewhat different match criteria, so sometimes this is useful). In this case, usually we don't need _source information on the suggestions, so filtering these out can improve performance. However, source filtering can only be done at the root of the request, which means we're stuck with a global on/off of _source information for all of our response.

Anyone know of a way to toss the source just on the typeahead suggestions above?

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