OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.45k stars 2.41k forks source link

Custom analyzers in Elasticsearch no longer work #17012

Closed MikeAlhayek closed 1 week ago

MikeAlhayek commented 1 week ago

Describe the bug

When specifying a custom analyzer in Elasticsearch as explained here https://docs.orchardcore.net/en/latest/reference/modules/Elasticsearch/#elasticsearch-analyzers it does create that custom analyzer in the Elasticsearch service.

Orchard Core version

2.x

To Reproduce

Configure custom analyzer like this:

"OrchardCore_Elasticsearch": {
      // Other settings
      "Analyzers": {
        "standard": {
          "type": "standard"
        },
        "keyword": {
          "type": "keyword"
        },
        "whitespace": {
          "type": "whitespace"
        },
        "knowledgebase_analyzer": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": [
            "lowercase",
            "stop"
          ],
          "char_filter": [
            "html_strip"
          ]
        }
      }
    }

Create an index using the custom knowledgebase_analyzer. Now try to search for anything you'll get an error

[multi_match] analyzer [knowledgebase_analyzer] not found

This issue was caused by PR #16843

github-actions[bot] commented 1 week ago

We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues).

This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here.

denispetrische commented 1 week ago

I applied this configuration

"OrchardCore_Elasticsearch": {
  "ConnectionType": "SingleNodeConnectionPool",
  "Url": "http://localhost",
  "Ports": [ 9200 ],
  "Analyzers": {
    "standard": {
      "type": "standard"
    },
    "keyword": {
      "type": "keyword"
    },
    "whitespace": {
      "type": "whitespace"
    },
    "knowledgebase_analyzer": {
      "type": "custom",
      "tokenizer": "standard",
      "filter": [
        "lowercase",
        "stop"
      ],
      "char_filter": [
        "html_strip"
      ]
    }
  }
}

Created index with knowledgebase_analyzer image

We can see that analyzer were created under name "default", it is necessary because for now there is no mechanism to specify concrete field for analyzer to be applied.

image

You can see also, that char filters are still not supported.

I created few Menu content Items, I can see them in the default_my index directly image

I created a query and it works image image

I created also multimatch query image image

So... everything works fine