It seems there is no nice way to programmatically define mappings with the Java API.
One has to generate a json string, or a map of maps, or comma-separated string format.
This is true for CreateIndexRequestBuilder.setSettings(), CreateIndexRequestBuilder.addMapping(), PutMappingRequestBuilder.setSource().
Can we have a builder API for creating mappings?
One that allows us to add types (and specific support for setting default), add fields, specify types, with options?
Pretty please?
Pinging @elastic/es-core-infra
This issue is still valid with high level rest client.
Soooo, yes, we'd like this. Mostly. But it feels like a fair bit of work to build and would go out of date pretty quickly unless we have some way of automatically checking that it lines up with what our mappings support. And none of us have any good ideas on how to do that....
Given that this issue hasn't seen a lot of discussion in two years I'm going to close it. But if anyone has any good ideas about how to keep these up to date then reply and reopen. I'm thinking more of a way to automatically test what we'd write rather than generate code. We tend to prefer that sort of thing.
Most helpful comment
Pretty please?