0

In Elasticsearch I wanted to index some fields with my custom analyzer. So I added to additional configurations my analyzer:

{
    "analysis":{
      "analyzer": {
        "my_analyzer": { 
          "type": "custom",
          "tokenizer": "standard",
          "filter": [
            "lowercase",
            "polish_stem",
            "asciifolding",
            "pl_stop"
          ]
        }
      }
}

, then I added new mapping ( to Override type mappings), for example:

    "title": {
    "type": "text",
"boost": 9500,
"store": true,
"term_vector": "with_positions_offsets",
"analyzer": "my_analyzer"},

Then I deleted index and restarted Liferay. Portal created a new index with my custo mapping and my analyzer correctly. Then I reindexed my docs. And when I search sth in Elasticsearch it shows expected results, I see that it analyzed my fields as I wanted. But when I search through Liferay portal I see no change, my field is not analyzed. What I am doing wrong? I have the new index and data comes from it so why Liferay does not use it?

PS: I tried to add nested field to the main field and set them different mapping, but Liferay didn't want to search with nested field ex. "title.analyzed_field". Thank's for any suggestions!

danny
  • 4,337
  • 3
  • 9
  • 10
  • 1- Are you using out-of-the-box search bar or a custom developed portlet? 2- What fields did you redefined with your new analyzer? 3- You can also try configuring DEBUG traces in Liferay side of elasticsearch packages in order to get more information about the queries that are sent to Elasticsearch. – jorgediaz-lr Dec 17 '19 at 07:41
  • Thanks @jorgediaz-lr for reply. 1. I use custom portlet and connect with Elastic throught Liferay connector, and I search using Liferay's indexSearcherHelper.search() method. 2. I redefined three fields, one that Liferay delivers (title), and two custom filelds. For each field analyzer works perfect when I run query on Elastic, but when i run the same query with Liferay it looks like it does not use it at all. 3. I did, queries look correctly (unfortunatelly). – danny Dec 17 '19 at 09:33

0 Answers0