RE: Custom indices settings in embeded elasticSearch

thumbnail
Jonatan Cloutier, modified 6 Years ago. New Member Posts: 24 Join Date: 6/7/13 Recent Posts
Hello,
We are trying to set indices settings using the additionalIndexConfigurations from https://portal.liferay.dev/docs/7-1/deploy/-/knowledge_base/d/advanced-configuration-of-the-liferay-elasticsearch-adapter . While this does work with the remote server. We cannot make it work for our development environment and would prefer not have to setup an external elasticsearch for each dev.
Here is a simplified config that I cannot make it work with the embedded version (debugging using curl, but the issue is the same with the system settings config, it's just way harder to see the error):
curl -X PUT "localhost:9200/asciifold_example?pretty" -H 'Content-Type: application/json' -d'
{
    "settings" : {
        "analysis" : {
            "analyzer" : {
                "default" : {
                    "tokenizer" : "standard",
                    "filter" : ["standard", "my_ascii_folding"]
                }
            },
            "filter" : {
                "my_ascii_folding" : {
                    "type" : "asciifolding",
                    "preserve_original" : true
                }
            }
        }
    }
}'

the result is
{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "Custom Analyzer [default] failed to find filter under name [asciifolding]"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "Custom Analyzer [default] failed to find filter under name [asciifolding]"
  },
  "status" : 400
}

The only filter I found that was working are "standard" (the default one) and "lowercase" (that Liferay use).

Is there some way to use/enable the other elastic analyzer filters?
thumbnail
David H Nebinger, modified 6 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
Hey, so you could have just one elastic server instance shared w/ for all of the developers... In the remote configuration, just use a different prefix for each. That way you only have one server, but each dev gets their own instance.
thumbnail
Jonatan Cloutier, modified 6 Years ago. New Member Posts: 24 Join Date: 6/7/13 Recent Posts
That could be a solution but I see a lot of issues compared to a local one, starting from the networking issue if the dev work out of the office, let’s say even through a mobile network in the train (I do this!).
Thank you for the suggestion, though.
thumbnail
David H Nebinger, modified 6 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
The embedded elastic is not going to be as fully functional as a real remote elastic... After all, embedded uses all of the JVM resources that Liferay wants to use, so adding more Elastic functionality would take resources away from the portal.

If you need the remote elastic in your local environment, you can always spin up elastic on your local machine and let Liferay treat it as a remote... Heck, you can create a docker container w/ elastic plus the analyzers, etc. that Liferay uses and then the argument of "too hard to set up on a developer workstation" goes out the window; they would just launch the docker container and they'd be off to the races.
thumbnail
Jonatan Cloutier, modified 6 Years ago. New Member Posts: 24 Join Date: 6/7/13 Recent Posts
I still thought the embed elastic was only limited in capacity, not in functionality. It looks like we will go the route of having different config for our dev and only  start a local remote elastic when really working on search features.
Thank you for the ideas.
thumbnail
Jorge Díaz, modified 6 Years ago. Liferay Master Posts: 753 Join Date: 1/9/14 Recent Posts
My advice is to not use embedded Elasticsearch, it is not supported even by Elastic see: https://www.elastic.co/blog/elasticsearch-the-server#_embedded_elasticsearch_not_supported
If you don't want to have an additional machine with the Elasticsearch node, my advice is to at least, install it inside Liferay server, but outside Liferay in a separate folder, so it will run in a different process and you will avoid lots of problems.

In my opinion having embedded Elasticsearch by default in Liferay bundle is a mistake. Liferay should provide a bundle with a preinstalled Elasticsearch, but outside tomcat java process and a script that launches both tomcat and elasticsearch process.

Installing a Elasticsearch server is very easy, just download the zip file and unzip it.
thumbnail
Jonatan Cloutier, modified 6 Years ago. New Member Posts: 24 Join Date: 6/7/13 Recent Posts
I’m not talking about any server deployment, but about local development environment. We try to keep it the simplest possible. Having to run one more dependencies add some complexity to that.
I know installing and configuring elastic is not that hard.