Elasticsearch 5.2.2 java addsort has error

https://www.elastic.co/guide/en/elasticsearch/reference/5.2/fielddata.html#_enabling_fielddata_on_literal_text_literal_fields

Is there java api which can implement this function?

This is a mapping configuration, you have to change the mapping & reindex your datas.

Sorry, I am still confused..How to change mapping and reindex datas? By configuration file, restful api or java transport client?

Both are possible.
You should read:
https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-put-mapping.html

In Java

	try {
		String template = FileUtils.readFileToString(new File(jsonTemplateFile));
		Client client = ElasticsearchService.getInstance().getClient(documentType);

		PutIndexTemplateResponse response = client.admin().indices()
				.preparePutTemplate(documentType.getIndexName())
				.setSource(template)
				.get();

		isOk = response.isAcknowledged();
	} catch (Exception e) {
		logger.severe(ExceptionUtils.getFullStackTrace(e));
	}

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