indices client and xcontent/json support
See original GitHub issueHello and I have a question: I am trying out this new fluent client and have a bunch of projects that I wanted to migrate from the RHLC to the new API client. Now I am kinda stuck on an inconvenient spot, creating an index with settings and mapping. the builder and functional pattern are nice, though in our projects we put json-files for mappings and settings which are read and converted into an object/xContentBuilder so we do not have to implement complex settings/mappings into java code (and reuse without copy paste).
kinda like that
CreateIndexRequest createIndexRequest = new CreateIndexRequest(indexName)
.settings(this.elasticsearchIndexService.createSettings(ELASTICSEARCH_INDEX_SETTINGS_FILE))
.mapping(this.elasticsearchIndexService.createMapping(ELASTICSEARCH_INDEX_MAPPING_FILE,
ELASTICSEARCH_INDEX_MAPPING_FOLDER, shop));
AcknowledgedResponse indexCreateResponse = this.restHighLevelClient.indices().create(createIndexRequest, RequestOptions.DEFAULT);
depending on the shop
parameter different mappings are loaded.
Is there a similar and fluent way doing that in the new client or are there any plans supporting json/xcontent?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:13
- Comments:13 (7 by maintainers)
Top Results From Across the Web
Index API | Java Transport Client (deprecated) [7.17] - Elastic
The following example indexes a JSON document into an index called twitter, under a type called _doc , with id valued 1: import...
Read more >I am working on ES for the first time. I am trying to upload a ...
I am creating a new index and then mapping the json data ... refer to this Elasticsearch docs for field datatype supported by...
Read more >Connecting to an Elasticsearch cluster - Quarkus
We inject an Elasticsearch RestHighLevelClient inside the service. We create an Elasticsearch index request. We use Vert.x JsonObject to serialize the object ...
Read more >IndexRequest - elasticsearch 7.16.1 javadoc
Index request to index a typed JSON document into a specific index and make it ... Fields inherited from class org.elasticsearch.action.support.replication.
Read more >CreateIndexRequest.settings - Java - Tabnine
client.admin().indices().create( new CreateIndexRequest(indexKey) .settings( ... The settings to create the index with (either json/yaml/properties format) ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We’ve added support for loading JSON directly from object builders with a new
withJson(someJson)
method in PR #200.This is backwards compatible and will be in the next 7.17 and 8.1 patch releases.
The documentation for this new feature is already up for the main branch.
(don’t think this is the right place for this, but trying to help)
@sulaukad to build a query you could use:
or in a builder: