Unable to create index when "reverse: true" on value field

Update: nm just didn’t read the docs closely enough, source has to be a reference ie Collection('collection_name).

I have an identical index of the same signature that is not reversed but when I attempt to call CreateIndex() on the same collection I get the following response from the web shell:

Existing Index:

{
  name: "strategy_metrics_by_strategy_ts",
  unique: true,
  serialized: true,
  source: "strategy_metrics",
  terms: [
    {
      field: ["data", "strategy"]
    }
  ],
  values: [
    {
      field: ["data", "insertedAt"]
    },
    {
      field: ["ref"]
    }
  ]
}

New Index:

CreateIndex({
  name: "strategy_metrics_by_strategy_ts_desc",
  unique: true,
  serialized: true,
  source: "strategy_metrics",
  terms: [
    {
      field: ["data", "strategy"]
    }
  ],
  values: [
    {
      field: ["data", "insertedAt"],
      reverse: true
    },
    {
      field: ["ref"]
    }
  ]
});

Error response:

Error: [
  {
    "position": [
      "create_index"
    ],
    "code": "validation failed",
    "description": "document data is not valid.",
    "failures": [
      {
        "field": [
          "source"
        ],
        "code": "invalid type",
        "description": "Invalid type String, expected type SourceClass."
      }
    ]
  }
]

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