Elastic are updating their docs to use the RestHighLevelClient with Java now. It also has a mapping API:
Now how do you make a request like this with that API?
PUT /test
{
"settings": {
"analysis": {
"filter": {
"email": {
"type": "pattern_capture",
"preserve_original": 1,
"patterns": [
"([^@]+)",
"(\\p{L}+)",
"(\\d+)",
"@(.+)",
"([^-@]+)"
]
}
},
"analyzer": {
"email": {
"tokenizer": "uax_url_email",
"filter": [
"email",
"lowercase",
"unique"
]
}
}
}
},
"mappings": {
"emails": {
"properties": {
"email": {
"type": "string",
"analyzer": "email"
}
}
}
}
}
Are you supposed to split it in two requests and use this API for the second request? https://www.elastic.co/guide/en/elasticsearch/client/java-rest/master/java-rest-high-indices-put-settings.html
Or is the RestHighLevelClient intended for high performance operations, but for initial configuration you are free to use RestTemplate (Spring) or any other normal Java Rest Client?