npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@elastic/request-converter-dotnet

v9.5.7

Published

Converts Elasticsearch Dev Console requests to Elastic.Clients.Elasticsearch (.NET) code. .NET WASM bundle consumed by @elastic/request-converter.

Readme

@elastic/request-converter-dotnet

The .NET request converter for Elasticsearch, compiled to WebAssembly. It turns a parsed Dev Console request into Elastic.Clients.Elasticsearch (.NET) client code, with the target Elastic.Clients.Elasticsearch version embedded in the WASM bundle itself.

This package is consumed by @elastic/request-converter's C# exporter, which loads it as an ExternalExporter plugin. It is also usable standalone from Node by calling its boot() factory directly, as shown below.

Usage

import { boot } from "@elastic/request-converter-dotnet";

const { check, convert } = await boot();

const payload = {
  requests: [
    {
      api: "search",
      body: { query: { term: { "user.id": { value: "kimchy" } } } },
      method: "GET",
      params: { index: "my-index-000001" },
      path: "/my-index-000001/_search",
      query: { from: "40", size: "20" },
      raw_path: "/my-index-000001/_search",
      source: "GET /my-index-000001/_search?from=40&size=20",
      url: "/my-index-000001/_search?from=40&size=20",
    },
  ],
  options: {
    document_type_name: "MyDocument",
    syntax_mode: "descriptor",
    use_strongly_typed_document: true,
  },
};

const checked = JSON.parse(check(JSON.stringify(payload)));
// checked.return === true

const converted = JSON.parse(convert(JSON.stringify(payload)));
console.log(converted.return);
// var request = new SearchRequestDescriptor<MyDocument>() ...

Contract

Both check and convert are synchronous, take a JSON string, and return a JSON string. Field names are snake_case throughout.

  • check(input) - input {"requests": ParsedRequest[]}; output {"return": <bool>, "error"?: "..."}. It is a yes/no probe: a request the converter cannot handle (unsupported endpoint, invalid body, ...) makes it return false rather than an error.
  • convert(input) - input {"requests": ParsedRequest[], "options": ConvertOptions}; output {"return": <string>, "error"?: "..."}. On failure, error is a concise, user-facing message (no stack trace) naming the failing request and the reason.

ParsedRequest is produced by the host's parser (turning Dev Console text into an API name and URL parameters needs the Elasticsearch schema, which this package does not carry), so this package only converts requests already parsed into that shape.

Options

options on convert accepts:

  • document_type_name (string, default MyDocument) - the placeholder document type name used when use_strongly_typed_document is set.
  • syntax_mode (object_initializer | descriptor, default object_initializer) - the emitted C# syntax. object_initializer emits object initializers (new SearchRequest { Query = ... }); descriptor emits the fluent descriptor chain (new SearchRequestDescriptor().Query(q => ...)).
  • type_name_style (Simplified | Fqn | GlobalFqn, default Simplified) - how type names are spelled in the generated code.
  • use_strongly_typed_document (bool, default false) - switches field references to Infer.Field<DocumentTypeName>(x => x.Path) lambdas and a generic request's document body to new DocumentTypeName { ... }. Pairs with syntax_mode: "descriptor" to produce the generic XDescriptor<DocumentTypeName> flavor.
  • debug (bool, default false) - appends the full exception (type and stack trace) to a failed convert's error, after a --- debug --- marker.

The document_type_name given (MyDocument by default) is not a type the converter generates; the caller supplies it, so any typed-document example in the generated output is illustrative and generally does not compile or round-trip as-is.

Versioning

This package's major and minor version track the elasticsearch-net branch it was built from (for example a build from the 9.1 branch ships as 9.1.x); the patch number increments freely on each publish and carries no meaning beyond ordering. The exact embedded client is recorded in package.json under the elasticsearch key: clientVersion is the Elastic.Clients.Elasticsearch version compiled into the bundle, and commit is the elasticsearch-net commit the bundle was built from.

Builds from the main branch are versioned off the commit they were built from, as 0.0.0-main.g<commit> (for example 0.0.0-main.g1a2b3c4d5e6f). That version names the built commit and claims no target release, since main may be aiming at the next minor or at the next major. Such builds are published under the latest-main dist-tag and never take latest; reference that tag rather than a version range. Their provenance is in the elasticsearch metadata as usual: commit for the full commit, and clientVersion set to unreleased.

Building from source

This package is assembled from a published .NET WASM AppBundle; see src/RequestConverter.Wasm in the elasticsearch-net repository for build prerequisites and instructions.