I have an index defined like this:
{
name: "foo_by_term_and_another_term",
source: Collection("foo_bar"),
terms: [{ field: ["data", "term"] }, { field: ["data", "anotherTerm"] }],
values: [{ field: ["data", "fooID"] }],
}
From documentation, it is possible to get the first matching document:
If
Match
only returns a single document, or only the first document is needed,Get
may be used to retrieve the document.
For example Get(Match(Index("foo_by_term_and_another_term"), ["term", "anotherTerm"]))
. This will return the first matched document.
However my index definition only has fooID
in its values
. Is there a simple way to only get fooID
instead of the whole document. I’m currently doing:
Select(
["data", "fooID"]
Get(
Match(
Index("foo_by_term_and_another_term"),
["term", "anotherTerm"]
)
)
)