Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working with Elasticsearch Mappings #44

Open
eric-kolotyluk opened this issue Sep 6, 2022 · 2 comments
Open

Working with Elasticsearch Mappings #44

eric-kolotyluk opened this issue Sep 6, 2022 · 2 comments

Comments

@eric-kolotyluk
Copy link

eric-kolotyluk commented Sep 6, 2022

I apologize if this is not the appropriate forum for these questions, so please direct me to the appropriate place if necessary...

We are in the process of adopting JSON Schema, and we are heavy users of Elasticsearch. One of the ideas we are considering is using JSON Schema to define our entities in Elasticsearch in such as way that we can automatically generate the Elasticsearch Mapping from the JSON Schema, such that JSON Schema is always (as much as possible) our core schema mechanism.

Would it be appropriate to use different dialects and vocabularies that define keywords and such in support of guiding the Elasticsearch Mapping generation. For example, by default we generally want to define 'keyword' data instead of the default 'text' data; but in some cases we might want to override the defaults in our JSON Schema with an 'elasticsearch' keyword, for example

  "properties": {
    "explanation": {
      "description": "a natural language explanation/justification",
      "type": "string",
      "elasticsearch": {
        "fieldDataType": "text",
        "$comment": "override 'keyword' default"
      }
    }
  }

Am I making sense, or out to lunch? Am I understanding the intent of JSON Schema Vocabularies?

@handrews
Copy link
Contributor

handrews commented Sep 6, 2022

Yes, this is exactly what they are for! Keyword design can be a bit of a tricky topic, so I recommend looking through the slides (and reading the presentation notes - don't forget to scroll to make sure you see all of the notes) linked in the Keyword Behaviors / JSON Schema as a Framework (JSF) discussion. Feel free to comment in general there, or to ask specific questions about your situation here.

@eric-kolotyluk
Copy link
Author

Phew, thanks. 🙄

While I have been using JSON Schema for years, I have never used such advanced features, and given I am the reason we are adopting JSON Schema, I don't want to make too many mistakes here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants