Java RestHighLevelClient put mapping manually


(Onoxider) #1

Hello,

is there any way to put mapping with RestHighLevelClient?

I know that it's possible with TransportClient via this Doc page:
https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-admin-indices.html

But as for RestHighLevelClient I haven't found any information.

Best regards

Добрый день!

Подскажите, пожалуйста, есть ли возможность задать маппинг через RestHighLevelClient?
ну или хотя бы через low level client.

с уважением,


(Val Crettaz) #2

In one of the next versions 6.x, it looks like it will be possible to use the CreateIndex API call which will allow to set a mapping at index creation time:

https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.x/java-rest-high-create-index.html


(David Pilato) #3

Yeah. And here is how I'm doing it in the mean time:


(Onoxider) #4

I'm sorry, I forgot to mention that the version I'm using is 6.1, so it's better to get to 6.x since it has more features?


(Val Crettaz) #5

6.x is not released yet :slight_smile: that was just a link to documentation of the next future release.


(Onoxider) #6

Yes, 6.1 is the current and it doesn't have CreateIndex API :frowning:

By the way, for some reason gradle dependency is not working i.e. after ptting the following dependency no packages are being added to the project:

compile 'org.elasticsearch.client:elasticsearch-rest-high-level-client:6.2.0'

(Val Crettaz) #7

Normal since 6.2 is not released yet

You can inspire yourself from the code @dadoonet provided earlier, that should do the trick


(Onoxider) #8

Thank you, I'll look through it.

You are doing a workaround by getting lowlevelclient and performing basic http requests to put mapping, am I correct?


(Onoxider) #9

Yeah, apparently this is only way to do.

So, to sum up, there's no way in current stable version(6.1) to put mapping via High Level Client only, right?


(Val Crettaz) #10

Correct. As far as I know.


(system) #11

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.