Example usage for com.liferay.portal.search.elasticsearch6.settings TypeMappingsHelper addTypeMappings

List of usage examples for com.liferay.portal.search.elasticsearch6.settings TypeMappingsHelper addTypeMappings

Introduction

In this page you can find the example usage for com.liferay.portal.search.elasticsearch6.settings TypeMappingsHelper addTypeMappings.

Prototype

public void addTypeMappings(String indexName, String source);

Source Link

Usage

From source file:com.liferay.blade.samples.indexsettingscontributor.IndexSettingsContributor.java

License:Apache License

@Override
public void contribute(String indexName, TypeMappingsHelper typeMappingsHelper) {

    try {//from  ww w  . j  a va2s.  c  o m
        String mappings = ResourceUtil
                .readResouceAsString("META-INF/resources/mappings/index-type-mappings.json");

        typeMappingsHelper.addTypeMappings(indexName, mappings);
    } catch (Exception e) {
        e.printStackTrace();
    }
}