peerkar / liferay-gsearch

Google like search for Liferay 7 CE and DXP
Other
56 stars 36 forks source link

Error from ElasticSearch for suggestions #7

Closed abu-zamzan closed 6 years ago

abu-zamzan commented 6 years ago

Hi Do you have any idea why do I get this error :

[2018-07-30 18:35:07,912][DEBUG][action.suggest           ] [Neophyte] [liferay-20116][4], node[gCLBZaopQMyVn77nW4TIBQ], [P], v[4], s[STARTED], a[id=oGACuF3LT4eq97pBlX6Xlw]: failed to execute [[[liferay-20116]], suggestSource[{"text":"Univ","suggester244":{"completion":{"field":"keywordSearch_en_US.suggest","size":5}},"suggester238":{"phrase":{"field":"keywordSearch_en_US.ngram","size":5,"real_word_error_likelihood":0.95,"confidence":0.1,"max_errors":2.0,"gram_size":2}}}]]
RemoteTransportException[[Neophyte][127.0.0.1:9300][indices:data/read/suggest[s]]]; nested: ElasticsearchException[failed to execute suggest]; nested: IllegalArgumentException[No mapping found for field [keywordSearch_en_US.ngram]];
Caused by: ElasticsearchException[failed to execute suggest]; nested: IllegalArgumentException[No mapping found for field [keywordSearch_en_US.ngram]];
        at org.elasticsearch.action.suggest.TransportSuggestAction.shardOperation(TransportSuggestAction.java:152)
        at org.elasticsearch.action.suggest.TransportSuggestAction.shardOperation(TransportSuggestAction.java:61)
        at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:282)
        at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:278)
        at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:77)
        at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:376)
        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: java.lang.IllegalArgumentException: No mapping found for field [keywordSearch_en_US.ngram]
        at org.elasticsearch.search.suggest.phrase.PhraseSuggestParser.parse(PhraseSuggestParser.java:176)
        at org.elasticsearch.search.suggest.SuggestParseElement.parseInternal(SuggestParseElement.java:94)
        at org.elasticsearch.action.suggest.TransportSuggestAction.shardOperation(TransportSuggestAction.java:145)
        ... 9 more
[2018-07-30 18:35:07,912][DEBUG][action.suggest           ] [Neophyte] [liferay-20116][1], node[gCLBZaopQMyVn77nW4TIBQ], [P], v[4], s[STARTED], a[id=LMVECHtZR3upFVqVS7MeQw]: failed to execute [[[liferay-20116]], suggestSource[{"text":"Univ","suggester244":{"completion":{"field":"keywordSearch_en_US.suggest","size":5}},"suggester238":{"phrase":{"field":"keywordSearch_en_US.ngram","size":5,"real_word_error_likelihood":0.95,"confidence":0.1,"max_errors":2.0,"gram_size":2}}}]]
RemoteTransportException[[Neophyte][127.0.0.1:9300][indices:data/read/suggest[s]]]; nested: ElasticsearchException[failed to execute suggest]; nested: IllegalArgumentException[No mapping found for field [keywordSearch_en_US.ngram]];
Caused by: ElasticsearchException[failed to execute suggest]; nested: IllegalArgumentException[No mapping found for field [keywordSearch_en_US.ngram]];
        at org.elasticsearch.action.suggest.TransportSuggestAction.shardOperation(TransportSuggestAction.java:152)
        at org.elasticsearch.action.suggest.TransportSuggestAction.shardOperation(TransportSuggestAction.java:61)
        at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:282)
        at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:278)
        at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:77)
        at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:376)
        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: java.lang.IllegalArgumentException: No mapping found for field [keywordSearch_en_US.ngram]
        at org.elasticsearch.search.suggest.phrase.PhraseSuggestParser.parse(PhraseSuggestParser.java:176)
        at org.elasticsearch.search.suggest.SuggestParseElement.parseInternal(SuggestParseElement.java:94)
        at org.elasticsearch.action.suggest.TransportSuggestAction.shardOperation(TransportSuggestAction.java:145)
        ... 9 more
leond08 commented 6 years ago

You're missing the querySuggestion mapping

it must be look like this

"querySuggestion": {
"dynamic_templates": [
{
"template_keywordSearch": {
"mapping": {
"type": "string",
"fields": {
"ngram": {
"search_analyzer": "standard",
"analyzer": "gsearch_shingle_analyzer",
"type": "string"
},
"suggest": {
"search_analyzer": "simple",
"analyzer": "simple",
"type": "completion"
}
}
},
"match": "keywordSearch_*",
"match_mapping_type": "string"
}
}
],
"properties": {
"companyId": {
"type": "string",
"index": "not_analyzed",
"store": true
},
"groupId": {
"type": "string",
"index": "not_analyzed",
"store": true
},
"keywordSearch_en_US": {
"type": "string",
"fields": {
"ngram": {
"type": "string",
"analyzer": "gsearch_shingle_analyzer",
"search_analyzer": "standard"
},
"suggest": {
"type": "completion",
"analyzer": "simple",
"payloads": false,
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
}
},
"priority": {
"type": "double",
"store": true
},
"spellCheckWord": {
"type": "string"
},
"uid": {
"type": "string",
"index": "not_analyzed",
"store": true
}
}
}
abu-zamzan commented 6 years ago

Where does it Need to be put? I have this in the portlet config for Suggester Configuration :

[
    {
        "suggesterType": "phrase",
        "fieldName": "keywordSearch_$language_id.ngram",
        "numberOfSuggestions":  5,
        "confidence": "0.1f",
        "gramSize": "2",
        "maxErrors": "2.0f",
        "realWordErrorLikelihood": "0.95f"
    },
    {
        "suggesterType": "completion",
        "fieldName": "keywordSearch_$language_id.suggest",
        "numberOfSuggestions":  5
    }
]

I think I copied and paste from : https://github.com/peerkar/liferay-gsearch/blob/master/binaries/latest/fi.soveltia.liferay.gsearch.core.configuration.GSearchCore.config#L2

peerkar commented 6 years ago

Hi,

First, sorry for the delay because of holidays.

You are having this error because your Elasticsearch backend is missing the querysuggestion mapping. In order to create that you either have to create it manually or to use the custom Elasticsearch adapter and reindex - which creates it automatically. The custom adapter is at the moment not compatible with 7.1.

The configuration above in your comment is for the module configuration. The mapping has to be created in the Elasticsearch index configuration. Please see the current document.

I'm improving documentation to include compatibility matrix and also starting to upgrade the project to support 7.1, including some improvements. If you want to stay updated, please watch the project.

abu-zamzan commented 6 years ago

I just want to let you know that I have already ported your portlet towards 7.1. I'm pretty sure that it is not a perfect adaptation but I did all required so that at least your portlet run on 7.1.

But I found a deadly bug concerning Soy Portlets with the latest release of Liferay.

No SoyPortlets are working.

Let me know if you are interested.

peerkar commented 6 years ago

Regarding the Soy bug: yes, please share. Could you also please check the Liferay issues at https://issues.liferay.com whether it's already fixed and if not, could you please report it so that it gets fixed. Thanks,,,

abu-zamzan commented 6 years ago

The bug is at this link: https://issues.liferay.com/browse/LPS-84198 I'm already in a talk with Liferay engineers for this bug but if you want to reproduce it I can send you the source code from the adapted code.

You can also yourself test the similar problem by using the latest Liferay IDE which comes with Blade 3.1.1 and generate a dummy soy portlet and try to run it on Liferay CE 7.1.10 GA1. The generated template is not working at all. At least your portlet is rendered but it is rendered twice which makes the UI inoperable.

Have a look : https://issues.liferay.com/browse/LPS-84287

peerkar commented 6 years ago

Letting you know that GSearch for 7.1 is now available. There should be no SOY issues on the UI anymore but please file a ticket if you encounter anything.

Please notice that there's no custom ES adapter yet so the suggestions or query configuration won't work. The adapter will become available in the coming weeks.