nextcloud / fulltextsearch_elasticsearch

šŸ” Use Elasticsearch to index the content of your Nextcloud
https://apps.nextcloud.com/apps/fulltextsearch_elasticsearch
GNU Affero General Public License v3.0
81 stars 30 forks source link

The client noticed that the server is not Elasticsearch and we do not support this unknown product #257

Closed Svedrin closed 1 year ago

Svedrin commented 1 year ago

I was wondering why my ES index doesn't get updated anymore, so I ran occ fulltextsearch:test. It greeted me with this error:

# occ fulltextsearch:test

.Testing your current setup:
Creating mocked content provider. ok
Testing mocked provider: get indexable documents. (2 items) ok
Loading search platform. (Elasticsearch) ok
Testing search platform. fail
In ProductCheckTrait.php line 32:

  The client noticed that the server is not Elasticsearch and we do not support this unknown product

fulltextsearch:test [--output [OUTPUT]] [-j|--json] [-d|--platform_delay PLATFORM_DELAY]

Google reveals that this is because the ES client library checks what it's connecting to, and if the server is not ES8, it will throw this error. Due to #240 my server is ES7, and the client ships with an ES8 library:

https://github.com/nextcloud/fulltextsearch_elasticsearch/blob/fc8da6e73b0d4d42934449c428421a89155e50d4/composer.json#L28-L30

So the client doesn't support ES7, and Nextcloud doesn't support ES8? Am I missing something? Is there a way to get this to work currently? šŸ˜•

Happyfeet01 commented 1 year ago

Same here

`lars@livesystem-debian:~$ sudo -uwww-data php8.2 /var/www/nextcloud/occ fulltextsearch:test

.Testing your current setup: Creating mocked content provider. ok Testing mocked provider: get indexable documents. (2 items) ok Loading search platform. (Elasticsearch) ok Testing search platform. fail In Test.php line 304:

Search platform (Elasticsearch) down ?

fulltextsearch:test [--output [OUTPUT]] [-j|--json] [-d|--platform_delay PLATFORM_DELAY]

lars@livesystem-debian:~$ sudo -uwww-data php8.2 /var/www/nextcloud/occ fulltextsearch:check Full text search 26.0.0

But with the live command I got this

IMG_20230510_112657.jpg

R0Wi commented 1 year ago

I recently upgraded to NC26 and I was able to get FTS working again. I'm using ES server 8.6.1 via Docker (see https://github.com/R0Wi/elasticsearch-nextcloud-docker) and this combination seems to work pretty well.

Note: if you have to upgrade from an earlier ES version and you don't want to loose your index data, use this upgrade guide. In my case I restarted the cluster once with version 7.17 to apply all migrations, then upgraded to 8.6.1.

ostasevych commented 1 year ago

I recently upgraded to NC26 and I was able to get FTS working again. I'm using ES server 8.6.1 via Docker (see https://github.com/R0Wi/elasticsearch-nextcloud-docker) and this combination seems to work pretty well.

Which version of the full text search - Elasticsearch platform app do you use? Is it 25.0 or 26.0?

Note: if you have to upgrade from an earlier ES version and you don't want to loose your index data, use this upgrade guide. In my case I restarted the cluster once with version 7.17 to apply all migrations, then upgraded to 8.6.1.

Please, explain, how to do it properly.

R0Wi commented 1 year ago

Which version of the full text search - Elasticsearch platform app do you use? Is it 25.0 or 26.0?

I'm using NC 26 together with the Fulltext Search Apps on version 26, too. Elasticsearch Server is on 8.6.1.

Please, explain, how to do it properly.

In my case I came from Elasticsearch 7.6.x (together with NC 25). I initially used this docker-compose with version 7.6.1 in the .env-file. I stopped the cluster and changed the version to 7.17.0 and restarted the cluster again (with the same volume, containing the 7.6.1 index data. If you want to be safe, create a backup of the docker volume before). I then waited for the cluster to be fully started (docker logs tells me that the cluster turned from state "red" to "yellow"). Then again stop that cluster and change the version to 8.6.1 in the .env-file. Restart, wait and you should be fine.

Like I said please also be aware of the official upgrade guide, since in theory there could be breaking changes (which I did not observe for the NC index). If you're uncertain, just use a new, empty docker volume and recreate your index via php occ fulltextsearch:index. Hope this helps!

Svedrin commented 1 year ago

Indeed, using ES 8.6.1 works :tada:

However, first I noticed that the ES client couldn't login to the ES cluster (tcpdump revealed that it didn't even send an Authorization header), and after I nuked the cluster to make sure I didn't have any passwords wrong, the cluster came up with SSL enabled and there was no option to have it accept a self-signed cert. So I tried disabling authentication and SSL by adding these two env vars to the ES container:

xpack.security.enabled=false
xpack.security.http.ssl.enabled=false

This worked, now occ fulltextsearch:test works and it's currently indexing.

R0Wi commented 1 year ago

Glad to hear that things are working for you now! Just two additional notes from my end:

  1. I'm using this docker-compose file and it works also as expected. So I think xpack.security.http.ssl.enabled=false should not be needed if you're connecting to port 9200 (?).
  2. If you're using authorization in your instance, have a look at my open PR which re-enables the possibility to configure the ES endpoint with embedded authorization credentials like in versions before app version 26 (for example http://elastic:mypassword@my-es-host:9200). Would be happy to get some feedback