redis / node-redis

Redis Node.js client
https://redis.js.org/
MIT License
16.95k stars 1.89k forks source link

ft.aggregate does not aggregate when filtering tags #2764

Open kvamsij opened 6 months ago

kvamsij commented 6 months ago

Description

flavour is a tag and it is array of strings. This how I declared in schema ( $.sfl.[*] as flavour TAG SEPARATOR ','). I can see the results without aggregation step but with aggregation i get an error message Value was not found in result

     const { results, total } = await client.ft.AGGREGATE(redisIndex, '*', {
            LOAD: ['@dataset', '@region', '@country', '@flavour'],
            STEPS: [
                {
                    type: AggregateSteps.FILTER,
                    expression: '@dataset == 1'
                },
                {
                    type: AggregateSteps.FILTER,
                    expression: '@region == "US"'
                },
                {
                    type: AggregateSteps.FILTER,
                    expression: '@flavour == "Chocolate"'
                },
                {
                    type: AggregateSteps.GROUPBY,
                    properties: ['@country'],
                    REDUCE: [
                        {
                            type: AggregateGroupByReducers.COUNT,
                            AS: 'count'
                        }
                    ]
                }

            ]
        })

Node.js Version

v20.12.2

Redis Server Version

redis_version:7.2.4

Node Redis Version

"redis": "^4.6.13"

Platform

linux

Logs

error message [ErrorReply: Value was not found in result (not a hard error)]

Results without aggregate step
{
  results: [
    [Object: null prototype] {
      dataset: '1',
      region: 'US',
      country: 'United States',
      flavour: 'Chocolate'
    },
    [Object: null prototype] {
      dataset: '1',
      region: 'US',
      country: 'United States',
      flavour: 'Chocolate'
    },
    [Object: null prototype] {
      dataset: '1',
      region: 'US',
      country: 'United States',
      flavour: 'Chocolate'
    },
    [Object: null prototype] {
      dataset: '1',
      region: 'US',
      country: 'Canada',
      flavour: 'Chocolate'
    },
    [Object: null prototype] {
      dataset: '1',
      region: 'US',
      country: 'United States',
      flavour: 'Chocolate'
    },
    [Object: null prototype] {
      dataset: '1',
      region: 'US',
      country: 'United States',
      flavour: 'Chocolate'
    },
    [Object: null prototype] {
      dataset: '1',
      region: 'US',
      country: 'United States',
      flavour: 'Chocolate'
    },
    [Object: null prototype] {
      dataset: '1',
      region: 'US',
      country: 'United States',
      flavour: 'Chocolate'
    },
    [Object: null prototype] {
      dataset: '1',
      region: 'US',
      country: 'United States',
      flavour: 'Chocolate'
    },
    [Object: null prototype] {
      dataset: '1',
      region: 'US',
      country: 'United States',
      flavour: 'Chocolate'
    },
    [Object: null prototype] {
      dataset: '1',
      region: 'US',
      country: 'United States',
      flavour: 'Chocolate'
    },
    [Object: null prototype] {
      dataset: '1',
      region: 'US',
      country: 'United States',
      flavour: 'Chocolate'
    },
    [Object: null prototype] {
      dataset: '1',
      region: 'US',
      country: 'United States',
      flavour: 'Chocolate'
    },
    [Object: null prototype] {
      dataset: '1',
      region: 'US',
      country: 'United States',
      flavour: 'Chocolate'
    },
    [Object: null prototype] {
      dataset: '1',
      region: 'US',
      country: 'United States',
      flavour: 'Chocolate'
    },
    [Object: null prototype] {
      dataset: '1',
      region: 'US',
      country: 'United States',
      flavour: 'Chocolate'
    },
    [Object: null prototype] {
      dataset: '1',
      region: 'US',
      country: 'United States',
      flavour: 'Chocolate'
    },
    [Object: null prototype] {
      dataset: '1',
      region: 'US',
      country: 'United States',
      flavour: 'Chocolate'
    }
  ],
  total: 11
}