nextcloud / fulltextsearch_elasticsearch

🔍 Use Elasticsearch to index the content of your Nextcloud
GNU Affero General Public License v3.0
80 stars 29 forks source link

Issues upgrading/setting up #317

Closed loxK closed 11 months ago

loxK commented 11 months ago

Hello,

I noticed my fulltext search wasn't working anymore. I searched and found the wiki, and saw "starting from app version 26, we use the Elasticsearch client version 8.6.1". All right, but then it says : "You can find the currently used ES client version in the app dependencies". There, the version is, at the time of writing, "elasticsearch/elasticsearch": "8.8.2".

That is confusing. So I went for 8.8.2.

I tried upgrading from 7.x, but it complained about some 6.x old data. Damn. I decided to wipe it all and installed a fresh 8.8.2.

At install time it shows me the default password for the elastic user. Elasticsearch is installed locally, so I configured network.host: 127.0.0.1 in /etc/elasticsearch/elasticsearch.yml. I then start it and give it a try, but got an empty response :

# curl -i -XGET -u elastic:[redacted] 127.0.0.1:9200
curl: (52) Empty reply from server

I decided to disable authentication by setting xpack.security.enabled: false, and restarted it. I now have a response:

#  curl -i -XGET 127.0.0.1:9200
HTTP/1.1 200 OK
X-elastic-product: Elasticsearch
content-type: application/json
content-length: 535

{
  "name" : "[readacted]",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "[readacted]",
  "version" : {
    "number" : "8.8.2",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "98e1271edf932a480e4262a471281f1ee295ce6b",
    "build_date" : "2023-06-26T05:16:16.196344851Z",
    "build_snapshot" : false,
    "lucene_version" : "9.6.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

Next I went to configure the Nextcloud app. I set to Elasticsearch and the servlet host to http://localhost:9200. But sadly it doesn't save the settings ! I opened up the console and noticed an HTTP 500 error while saving settings. In Nextcloud logs I noticed that error:

OC\\AllConfig::getSystemValueString(): Argument #2 ($default) must be of type string, bool given, called in /srv/www/nextcloud/apps.installed/fulltextsearch_elasticsearch/lib/Service/ConfigService.php on line 147 in file '/srv/www/nextcloud/lib/private/AllConfig.php' line 163

All right. Gave it a search and found this pull request. I applied this change and could then save the settings. That done, I gave it a try :

# 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. ok  
Locking process ok  
Removing test. fail  
Error detected, unlocking process ok 
In ConfigService.php line 125:

  Your ElasticSearchPlatform is not configured properly

So, the Removing test failed, and I am now stuck there ... I need help.

NC : 27.1.1

occ app:list | grep fullt
  - files_fulltextsearch: 27.0.1
  - files_fulltextsearch_tesseract: 27.0.0
  - fulltextsearch: 27.0.2
  - fulltextsearch_elasticsearch: 27.0.3
chriscroome commented 11 months ago

I've the same version:

apt-cache policy elasticsearch | head -n2
elasticsearch:
  Installed: 8.8.2

Testing with curl I have:

curl -i -XGET 127.0.0.1:9200
HTTP/1.1 200 OK
X-elastic-product: Elasticsearch
content-type: application/json
content-length: 532

{
  "name" : "nextcloud",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "XXX",
  "version" : {
    "number" : "8.8.2",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "98e1271edf932a480e4262a471281f1ee295ce6b",
    "build_date" : "2023-06-26T05:16:16.196344851Z",
    "build_snapshot" : false,
    "lucene_version" : "9.6.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

And in /etc/elasticsearch/elasticsearch.yml I have:


cluster.initial_master_nodes:
- nextcloud
http.host: 127.0.0.1
http.port: 9200
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
xpack.ml.enabled: false
xpack.security.enabled: false
xpack.security.enrollment.enabled: true
xpack.security.http.ssl:
    enabled: true
    keystore.path: certs/http.p12
xpack.security.transport.ssl:
    enabled: true
    keystore.path: certs/transport.p12
    truststore.path: certs/transport.p12
    verification_mode: certificate

And in apps/fulltextsearch_elasticsearch/lib/Service/ConfigService.php I don't have string ELASTIC_LOGGER_ENABLED, which seems odd, perhaps the different versions of the apps is the cause? I have:

occ app:list | grep search
  - files_fulltextsearch: 27.0.1
  - fulltextsearch: 27.0.1
  - fulltextsearch_elasticsearch: 27.0.2

It is working for me!

enoch85 commented 11 months ago

I think I got the same issue...

When running:

nextcloud_occ fulltextsearch:configure '{"search_platform":"OCA\\FullTextSearch_Elasticsearch\\Platform\\ElasticSearchPlatform"}'
nextcloud_occ fulltextsearch_elasticsearch:configure "{\"elastic_host\":\"http://elastic:$ELASTIC_USER_PASSWORD@localhost:9200\",\"elastic_index\":\"${NEXTCLOUD_INDEX}\"}"
nextcloud_occ files_fulltextsearch:configure "{\"files_pdf\":\"1\",\"files_office\":\"1\"}"

I get:

{
    "search_platform": "OCA\\FullTextSearch_Elasticsearch\\Platform\\ElasticSearchPlatform",
    "app_navigation": "0",
    "provider_indexed": "",
    "cron_err_reset": "0",
    "tick_ttl": "1800",
    "collection_indexing_list": "50",
    "migration_24": "1",
    "collection_internal": "local"
}
An unhandled exception has been thrown:
TypeError: OC\AllConfig::getSystemValueString(): Argument #2 ($default) must be of type string, bool given, called in /var/www/nextcloud/apps/fulltextsearch_elasticsearch/lib/Service/ConfigService.php on line 149 and defined in /var/www/nextcloud/lib/private/AllConfig.php:163
Stack trace:
#0 /var/www/nextcloud/apps/fulltextsearch_elasticsearch/lib/Service/ConfigService.php(149): OC\AllConfig->getSystemValueString()
#1 /var/www/nextcloud/apps/fulltextsearch_elasticsearch/lib/Service/ConfigService.php(78): OCA\FullTextSearch_Elasticsearch\Service\ConfigService->getAppValue()
#2 /var/www/nextcloud/apps/fulltextsearch_elasticsearch/lib/Command/Configure.php(80): OCA\FullTextSearch_Elasticsearch\Service\ConfigService->getConfig()
#3 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(298): OCA\FullTextSearch_Elasticsearch\Command\Configure->execute()
#4 /var/www/nextcloud/core/Command/Base.php(177): Symfony\Component\Console\Command\Command->run()
#5 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1040): OC\Core\Command\Base->run()
#6 /var/www/nextcloud/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#7 /var/www/nextcloud/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#8 /var/www/nextcloud/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run()
#9 /var/www/nextcloud/console.php(100): OC\Console\Application->run()
#10 /var/www/nextcloud/occ(11): require_once('...')

This is when using Elasticseach docker image 8.10.2. Note; 8.10.1 worked like two days ago. Both tested on Nextcloud 27.1.1. This try was made on fulltextsearch_elasticsearch 27.0.3

Please let me know if I should open a new issue. cc @ArtificialOwl

enoch85 commented 11 months ago

Maybe this is the reason? https://github.com/nextcloud/fulltextsearch_elasticsearch/commit/4aaa7e859a659e898e92e9c22cd351b1d7da9661

Nope, that actually seems to fix the issue, not 100% confirmed yet though.

EDIT, Confirmed, last commit fixes my issue at least.

enoch85 commented 11 months ago

@loxK Can you please try to patch with https://github.com/nextcloud/fulltextsearch_elasticsearch/pull/319 and see if it solves the issue?

ArtificialOwl commented 11 months ago

27.0.4 will be available in the next hour and should fix this

enoch85 commented 11 months ago

@ArtificialOwl Please let me know when released since I need to remove the patch from the VM.

Thanks!

enoch85 commented 11 months ago

27.0.4 is out!

Tested and works!

loxK commented 11 months ago

@enoch85 Tested and works too. Thanks guys.