RE: Portlet Custom Facet - Showing error to setup

Roselaine de Faria Marques Montero, modified 6 Years ago. New Member Posts: 5 Join Date: 7/4/19 Recent Posts
I´m try using the "Custom Facet" exactly like explain here: https://portal.liferay.dev/docs/7-1/user/-/knowledge_base/u/custom-facet#finding-indexed-fieldsBut, doesn't work emoticon - Its like the field are disable (following logs):
2019-08-19 11:04:50.810 ERROR [http-nio-8080-exec-4][ElasticsearchIndexSearcher:345] Unable to aggregate facet on a nonkeyword field
Failed to execute phase [query], all shards failed; shardFailures {[qb8LtG0nTz6f8bg4XJGATg][liferay-20099][0]: RemoteTransportException[[qb8LtG0][127.0.0.1:9300][indices:data/read/search[phase/query]]]; nested: IllegalArgumentException[Fielddata is disabled on text fields by default. Set fielddata=true on [catalogDefaultLanguageId] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.]; }
    at org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseFailure(AbstractSearchAsyncAction.java:293)
    at org.elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:133)
    at org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseDone(AbstractSearchAsyncAction.java:254)
    at org.elasticsearch.action.search.InitialSearchPhase.onShardFailure(InitialSearchPhase.java:101)
    at org.elasticsearch.action.search.InitialSearchPhase.access$100(InitialSearchPhase.java:48)
    at org.elasticsearch.action.search.InitialSearchPhase$2.lambda$onFailure$1(InitialSearchPhase.java:222)
    at org.elasticsearch.action.search.InitialSearchPhase.maybeFork(InitialSearchPhase.java:176)
    at org.elasticsearch.action.search.InitialSearchPhase.access$000(InitialSearchPhase.java:48)
    at org.elasticsearch.action.search.InitialSearchPhase$2.onFailure(InitialSearchPhase.java:222)
    at org.elasticsearch.action.search.SearchExecutionStatsCollector.onFailure(SearchExecutionStatsCollector.java:73)
    at org.elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:51)
    at org.elasticsearch.action.search.SearchTransportService$ConnectionCountingHandler.handleException(SearchTransportService.java:464)
    at org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:1130)
    at org.elasticsearch.transport.TransportService$DirectResponseChannel.processException(TransportService.java:1247)
    at org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1221)
    at org.elasticsearch.transport.TaskTransportChannel.sendResponse(TaskTransportChannel.java:66)
    at org.elasticsearch.action.support.HandledTransportAction$ChannelActionListener.onFailure(HandledTransportAction.java:112)
    at org.elasticsearch.search.SearchService$2.onFailure(SearchService.java:347)
    at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:341)
    at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:335)
    at org.elasticsearch.search.SearchService$4.doRun(SearchService.java:1082)
    at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:723)
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
    at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:41)
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: [Fielddata is disabled on text fields by default. Set fielddata=true on [catalogDefaultLanguageId] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.]; nested: IllegalArgumentException[Fielddata is disabled on text fields by default. Set fielddata=true on [catalogDefaultLanguageId] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.];
    at org.elasticsearch.ElasticsearchException.guessRootCauses(ElasticsearchException.java:657)
    at org.elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:131) 
But i see the mapping liferay (http://localhost:9200/_mapping/LiferayDocumentType?pretty), and show me like avaible:
     "catalogDefaultLanguageId" : {
            "type" : "text",
            "store" : true
          },

Actually, i did try a lot field and all show me the error. Anybody knows how can I fix it?Thank you !
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
Hi Roselaine,
Custom facets can't be configured for fields of type "text". You need to change that field type to be "keyword" in order to leverage the custom facet widget.