Мне нужно отобразить приведенное ниже сопоставление с помощью кода java, и я использую elasti c клиентский клиент resthighlevel уровня поиска 6.2.2 Мне нужно создать сопоставление перед созданием индекса.
{
"mappings": {
"properties": {
"events": {
"type": "nested",
"properties": {
"recommendationData": {
"type": "nested",
"properties": {
"recommendations": {
"type": "nested",
"properties": {
"recommendationType": {
"type": "keyword"
}
}
}
}
}
}
}
}
}
}
И я использую IndexRequest API для создания индекса перед созданием индекса, мне нужно сделать отображение.
public Object createIndex(Object document, String id) throws IOException {
Map documentMapper = objectMapper.convertValue(document, Map.class);
IndexRequest indexRequest = new IndexRequest(this.getIndexName(),
type, id).source(documentMapper, XContentType.JSON);
IndexResponse indexResponse = client.index(indexRequest);
return null;
}