Skip to content

@azure/search-documents ts bug #33135

Open
@FrancescoSaverioZuppichini

Description

  • Package Name: @azure/search-documents
  • Package Version: 12.1.0
  • Operating system: Mac os
  • nodejs
    • version: 22
  • browser
    • name/version:
  • typescript
    • version: ^5
  • Is the bug related to documentation in

Describe the bug
Trying to use the documentation but I have ts errors

To Reproduce
Steps to reproduce the behavior:

  1. Install the package
import {
  AzureKeyCredential,
  SearchClient,
  SearchIndexClient,
} from "@azure/search-documents"

const indexClient = new SearchIndexClient(
  "asd",
  new AzureKeyCredential("asd")
)
async function main() {
  const result = await indexClient.createIndex({
    name: "documents",
    fields: [
      {
        type: "Edm.String",
        name: "id",
        key: true,
      },
      {
        type: "Edm.String",
        name: "segmentId",
      },
      {
        type: "Edm.String",
        name: "content",
        searchable: true,
      },
      {
        name: "vector",
        type: "Collection(Edm.Single)",
        searchable: true,
        retrievable: false,
        stored: false,
        dimensions: 1536,
        vectorSearchProfile: "vector-profile-1",
      },
      {
        type: "Edm.ComplexType",
        name: "metadata",
        fields: [
          {
            type: "Collection(Edm.String)",
            name: "tags",
            searchable: true,
          },
        ],
      },
      {
        type: "Edm.Int32",
        name: "hiddenWeight",
        hidden: true,
      },
    ],
    vectorSearch: {
      compressions: [
        {
          name: "scalar-quantization",
          kind: "scalarQuantization",
          rerankWithOriginalVectors: true,
          defaultOversampling: 10.0,
          scalarQuantizationParameters: {
            quantizedDataType: "int8",
          },
        },
        {
          name: "binary-quantization",
          kind: "binaryQuantization",
          rerankWithOriginalVectors: true,
          defaultOversampling: 10.0,
        },
      ],
      algorithms: [
        {
          name: "hnsw-1",
          kind: "hnsw",
          hnswParameters: {
            m: 4,
            efConstruction: 400,
            efSearch: 500,
            metric: "cosine",
          },
        },
        {
          name: "hnsw-2",
          kind: "hnsw",
          hnswParameters: {
            m: 8,
            efConstruction: 800,
            efSearch: 800,
            metric: "hamming",
          },
        },
        {
          name: "eknn",
          kind: "exhaustiveKnn",
          exhaustiveKnnParameters: {
            metric: "euclidean",
          },
        },
      ],
      profiles: [
        {
          name: "vector-profile-hnsw-scalar",
          compression: "scalar-quantization",
          algorithm: "hnsw-1",
        },
      ],
    },
  })

  console.log(result)
}

main()

Expected behavior
The code copied and pasted from the doc should not have ts errors

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Thanks a lot

Image Image

Metadata

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.Searchcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions