Hi,
I think I explained my problem wrong so I do apologize:
In my collection I have for example two documents:
{
match_id: 5132545461,
picks_bans: [
{
is_pick: true,
hero_id: 105,
team: 0,
order: 0,
ord: 0,
match_id: 5132545461
},
{
is_pick: false,
hero_id: 66,
team: 1,
order: 1,
ord: 1,
match_id: 5132545461
},
],
}
and
{
match_id: 5132545462,
picks_bans: [
{
is_pick: true,
hero_id: 115,
team: 0,
order: 0,
ord: 0,
match_id: 5132545461
},
{
is_pick: true,
hero_id: 66,
team: 1,
order: 1,
ord: 1,
match_id: 5132545461
},
],
}
So I create an index that should return document that has int hero_id and bool is_pick i.e hero_id 66, is_pick true which should return 1 of the documents.
{
name: "hero_id_is_picked",
unique: false,
serialized: true,
source: "Matches",
terms: [
{
field: ["data", "picks_bans", "hero_id"]
},
{
field: ["data", "picks_bans", "is_pick"]
}
]
}
but the index would return two of the documents, ignoring the boolean value.
One of the solutions I tried to do was to create a binding index to filter the picks_bans to create array of just picks or bans (depending on index) like so:
CreateIndex({
name: "picks_hero_id",
source: {
collection: Collection("Matches"),
fields: {
picks: Query(
Lambda(
"matchDoc",
Filter(Select(["data","picks_bans"], Var("matchDoc")), Lambda("pick_ban", Equals(Select("is_pick", Var("pick_ban")), true)))
)
)
}
},
terms: [
{ binding: ["picks","hero_id"]}
],
values: [
{ binding: "picks"}
]
})
But this returns no data matches.
Ultimately my goal is to filter match documents on other criteria such as league_id, start_time and cluster and then see how many of certain hero_id picks or bans there are.