Elasticsearch 7.2 CreateIndexRequest mapping questions

CreateIndexRequest indexRequest = new CreateIndexRequest(indexName);
indexRequest.settings(Settings.builder().put("index.number_of_shards", 1));

String jsonst =
"{\n " +
" "properties" : {\n" +
" "syn": {\n" +
" "type": "text"\n" +
" }\n" +
" }\n" +
"}";
indexRequest.mapping(jsonst, XContentType.JSON);
CreateIndexResponse indexResponse = client.indices().create(indexRequest, RequestOptions.DEFAULT);

  • error
    mapping source must be pairs of fieldnames and properties definition.

What is the problem?

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