Convert JSON Schema definitions into Elasticsearch index mappings. Version 0.3.6 is the latest release (no frequent updates). This library supports most core Elasticsearch data types (string, numeric, boolean, date, range) and can handle nested objects, arrays, and $ref references. It differs from similar tools by providing simple functions like buildMappingsFor that wrap the mapping in an index-level structure. The package is ESM-only but also supports CommonJS via require. It does not handle the binary type or scaled_float. Suitable for developers who need to generate Elasticsearch mappings from existing JSON Schema without manual transformation.
npm install json-schema-to-es-mappingNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates converting a JSON Schema object into an Elasticsearch mappings object for an index named 'people'.
Manually add binary type mappings outside this library.
Set 'range: true' explicitly if you intend to use Elasticsearch range types.
Use a custom mapping for scaled_float fields.
Iterate over indexes and build separate mappings, then combine manually.
Ensure the schema has a top-level 'type: "object"' and a 'properties' object.
Set a valid Elasticsearch type (e.g., string, number, object) for every property in the schema.
Include a 'definitions' key with matching definition objects, or use a JSON Schema that resolves all $ref.
No dependency data recorded yet.