Add an Elasticsearch mapping export tool
Description
follows up on
Activity

Yoann RodièreFebruary 27, 2023 at 11:10 AM
Idea for the API:
Require starting Hibernate Search, which can be done offline, see and
Add the feature to the schema manager
E.g. we’d add methods such as this one to the schema manager:
And calling such methods would result in the creation of files in the given directory, with a predictable directory structure:
Of course the content of the export would be backend-specific; for Lucene, it would just do nothing (or maybe create the directory structure but leave a file for each index whose content says “the Lucene backend does not support exporting the schema”).
Later we might add more options (filtering, …) and features (export curl scripts, …), but let’s wait a bit before working on that: exporting json should be enough for most people.

Laurent AlmerasJune 20, 2022 at 6:49 PM
Thank you for this feedback !

Yoann RodièreJune 20, 2022 at 12:27 PM
Hey , I knew you had requested this, but when I implemented the feature I couldn’t find your message… I just stumbled upon it by chance, so here’s a (very very late) answer: you can now manage schemas manually in Hibernate Search 6 ( ) and there is also a flag to drop-and-create the schema when mass indexing ( , use .purge(false).dropAndCreateSchemaOnStart(true)
)
I hope this helps…

Laurent AlmerasJune 14, 2017 at 10:06 AM
Hello,
Related to this this CLI feature, public API to allow index dropping and schema creation (index by index) may be an appreciated feature to handle manually drop, create schema then reindex that may have better performance than a delete from match-all query (big performance hit for ES 2.4.5, much better performance for ES 5.x).
Details
Assignee
Marko BekhtaMarko BekhtaReporter
Yoann RodièreYoann RodièreComponents
Sprint
NoneFix versions
Priority
Major
Details
Details
Assignee
Reporter

The tool would allow to export a Hibernate Search-generated mapping so that users may use it in scripts or compare it to their existing Elasticsearch mapping.
The main issue was that such a tool should not have to connect to an Elasticsearch instance: we just want it to export the schema based on a configuration and a set of jars. Yet HSearch's metamodel creation and index manager creation/startup seem intertwined, and we cannot execute one without the other. So in order for the tool to exist, we need to bring some changes to HSearch's startup process.
See there for more details about the issue: https://hibernate.atlassian.net/browse/HSEARCH-2260?focusedCommentId=84220&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-84220 => This is no longer true in Hibernate Search 6; you can start it offline; see and