List all matching shingles

Hello everybody,

I have an index whose settings look something like this

"settings" : {
	"index" : {
		...
		"analysis" : {
			"filter" : {
				"suggestion_shingle" : {
					"max_shingle_size" : "5",
					"min_shingle_size" : "2",
					"output_unigrams" : "true",
					"type" : "shingle"
				},
				...
			},
			"analyzer" : {
				"suggestion" : {
					"filter" : [
						"lowercase",
						"suggestion_shingle"
					],
					"tokenizer" : "standard"
				},
				...
			},
			...
		}
	}
}

In the same index mapping I have a text field which uses the "suggestion" analyzer. I would like to be able to list (at search time) the shingles who match a certain query string, in the same fashion as the Explain API works.
For example, if my document collection was:

  1. "very long text"
  2. "this is a very long text"
  3. "much longer text"

and I searched "very long", I would expect a document ranking in which every document has a list of matching shingles which, in this specific case, would be

  1. ["very long", "very long text"]
  2. ["very long", "very long text"]
  3. []

Is there any way to retrieve those lists?

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