Is it possible to return only one result of each type?

I have an index as below:

[
  { "type": "a", "tags": ["foo"]},
  { "type": "a", "tags": ["foo", "bar"]},
  { "type": "b", "tags": ["foo", "baz"]},
]

It it possible that when searching "foo", even though it appears in 3 records, that I only return

[
  { "type": "a", "tags": ["foo"]},
  { "type": "b", "tags": ["foo", "baz"]},
]

as the first and second item in the index share the same type? Would I have to do some post processing with JavaScript to get this effect?

Hi @eightarms,
If I understand well your need, the usage of the distinct API parameter is exactly the functionality you are looking for.