nextcloud / fulltextsearch_elasticsearch

πŸ” Use Elasticsearch to index the content of your Nextcloud
GNU Affero General Public License v3.0
81 stars 30 forks source link

Elasticsearch and Docker Unknow error #358

Open fred-gb opened 6 months ago

fred-gb commented 6 months ago

Bonjour, πŸ‘‹πŸ»

All with docker. Nextcloud: 28.0.3 Elasticsearch: 8.6.1

When I run index manually. (I use this way in background: https://fariszr.com/en/nextcloud-fulltextsearch-elasticsearch-docker-setup/)

Memory: 67 MB
β”Œβ”€ Indexing  ────
β”‚ Action: indexDocument
β”‚ Provider: Files                Account: ********
β”‚ Document: 3327
β”‚ Info: httpd/unix-directory
β”‚ Title: ****
β”‚ Content size: 0
β”‚ Chunk:     18/18
β”‚ Progress:    all/79
└──
β”Œβ”€ Results ────
β”‚ Result:    214/214
β”‚ Index: files:3327
β”‚ Status: ok
β”‚ Message: {"_index":"index","_id":"files:3327","_version":3,"result":"updated","_shards":{"total":2,"successful":1,"failed":0},"_
β”‚ seq_no":166774,"_primary_term":45}
β”‚ 
└──
β”Œβ”€ Errors ────
β”‚ Error:     50/50
β”‚ Index: files:60850
β”‚ Exception: Elastic\Elasticsearch\Exception\ClientResponseException
β”‚ Message: unknown error
β”‚ 
β”‚ 
└──

When I try a test.

root@f6a892cce644:/var/www/html# su -s /bin/sh www-data -c 'php 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. ok  
Pausing 3 seconds 1 2 3 ok  
Initializing index mapping. ok  
Indexing generated documents. ok  
Pausing 3 seconds 1 2 3 ok  
Retreiving content from a big index (license). (size: 32386) ok  
Comparing document with source. ok  
Searching basic keywords:  
 - 'test' (result: 0, expected: ["simple"]) fail  
Error detected, unlocking process ok 
In Test.php line 676:

  Unexpected SearchResult: {"provider":{"id":"test_provider","name":"Test Provider"},"platform":{"id":"elastic_search","name":"El  
  asticsearch"},"documents":[],"info":[],"meta":{"timedOut":false,"time":1,"count":0,"total":0,"maxScore":0}}                      

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

In Nextcloudweb interface I type any word and I have no result...

Thanks

HPPinata commented 5 months ago

This is an issue with your elastic search server configuration. It needs to be accessible to the client as well. You can setup http basic auth in front of it and just type in the format in the setup page, but the elastic search endpoint must be externally accessible somehow. This is derived from my personal setup (with the specific and sensitive stuff stripped out) but should serve as a decent reference: https://github.com/HPPinata/Nextcloud Take a look at Section 3.3, 4. and 5.

ferdiga commented 3 weeks ago

Hi similar issue here NC 29.0.5 3 apps - Fulltextsearch all 29.0.1 elasticsearch 8.15.1 set up as descriebed here https://community.hetzner.com/tutorials/deploy-elk-stack-with-docker with some extension to make it work behind apache https://github.com/hetzneronline/community-content/pull/941/files

output of the command occ -vvv fulltextsearch:test

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. ok  
Pausing 3 seconds 1 2 3 ok  
Initializing index mapping. ok  
Indexing generated documents. ok  
Pausing 3 seconds 1 2 3 ok  
Retreiving content from a big index (license). (size: 32386) ok  
Comparing document with source. ok  
Searching basic keywords:  
 - 'test' (result: 0, expected: ["simple"]) fail  
Error detected, unlocking process ok 
In Test.php line 676:

  Unexpected SearchResult: {"provider":{"id":"test_provider","name":"Test Provider"},"platform":{"id":"elastic_search","name":"Elasticsearch"},"documents":[],"info":[],"meta":{"tim  
  edOut":false,"time":1,"count":0,"total":0,"maxScore":0}}   

Exception trace:
  at /var/www/nextcloud/apps/fulltextsearch/lib/Command/Test.php:676
 OCA\FullTextSearch\Command\Test->compareSearchResult() at /var/www/nextcloud/apps/fulltextsearch/lib/Command/Test.php:615
 OCA\FullTextSearch\Command\Test->search() at /var/www/nextcloud/apps/fulltextsearch/lib/Command/Test.php:437
 OCA\FullTextSearch\Command\Test->testSearchSimple() at /var/www/nextcloud/apps/fulltextsearch/lib/Command/Test.php:172
 OCA\FullTextSearch\Command\Test->execute() at /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at /var/www/nextcloud/core/Command/Base.php:177
 OC\Core\Command\Base->run() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at /var/www/nextcloud/lib/private/Console/Application.php:213
 OC\Console\Application->run() at /var/www/nextcloud/console.php:102
 require_once() at /var/www/nextcloud/occ:11

trying to use curl to simulate the query - as the test documents are not delete

curl -X GET "https://user:password@myserver/_search?pretty"  -H 'Content-Type: application/json' -d'
{
  "query": {
    "query_string": {
      "query": "simple",
      "default_field": "content"
    }
  }
}
'

results to

 {
  "took" : 16,
  "timed_out" : false,
  "_shards" : {
    "total" : 17,
    "successful" : 17,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1,
      "relation" : "eq"
    },
    "max_score" : 1.1710434,
    "hits" : [
      {
        "_index" : "ind_api_service",
        "_id" : "test_provider:simple",
        "_score" : 1.1710434,
        "_source" : {
          "owner" : "user1",
          "users" : [ ],
          "groups" : [ ],
          "circles" : [ ],
          "links" : [ ],
          "metatags" : [ ],
          "subtags" : [ ],
          "tags" : [ ],
          "hash" : "dc5617141771b9472dcc0739960bf07a",
          "provider" : "test_provider",
          "source" : "",
          "title" : "",
          "parts" : [ ],
          "content" : "testing document is a simple test"
        }
      }
    ]
  }
}

giving the result I would expect.

ferdiga commented 3 weeks ago

using Kibana to check the index content