julien-pal / node-red-contrib-elasticsearch

Node RED wrapper for elasticsearch node client
8 stars 5 forks source link

Sometimes uncaught exception with a search #19

Open ElGranLoky opened 2 years ago

ElGranLoky commented 2 years ago

Version: 1.1.24 Nodejs: 16.13.1 Node-RED: 2.20 ElastisearchDB: 7.3.1

   {
       "_source": false,
       "query": {
           "bool": {
               "filter": {
                   "bool": {
                       "must": [
                           {
                               "match_phrase": {
                                   "document": document.name
                               }
                           },
                           {
                               "range": {
                                   "date" : {
                                       "gte" : document.date
                                   }                
                               }
                           }
                       ]
                   }
               },
               "must": {
                   "match_phrase": {
                       "user": document.user
                   }
               }
           }
       }
   }
{
  "_index": "printer-2019-02-28",
  "_type": "print",
  "_id": "sycY5H4BAsqW3q4PO8y7",
  "_version": 1,
  "_score": null,
  "_source": {
    "date": "2019-02-28T10:21:22.000Z",
    "user": "XXXX",
    "pages": 3,
    "copy": 1,
    "printer": "printer01",
    "document": "name.doc",
    "size_paper": "A4",
    "driver": "CANON UFR",
    "duplex": "DUPLEX",
    "grayscale": "NOT GRAYSCALE",
    "size": "121kb"
  },
  "fields": {
    "date": [
      "2019-02-28T10:21:22.000Z"
    ]
  },
  "sort": [
    1551349282000
  ]
}

Normally the query works perfectly, but suddenly it gives the following error restarting nodered

10/2/2022 15:45:0010 Feb 14:45:00 - [red] Uncaught Exception: 10/2/2022 15:45:0010 Feb 14:45:00 - [error] TypeError: Cannot set properties of undefined (setting '_id') 10/2/2022 15:45:00 at next (/data/node_modules/node-red-contrib-elasticsearch-jupalcf/elasticsearch/elasticsearch-search.js:84:29) 10/2/2022 15:45:00 at /data/node_modules/node-red-contrib-elasticsearch-jupalcf/elasticsearch/elasticsearch-search.js:108:17 10/2/2022 15:45:00 at runMicrotasks () 10/2/2022 15:45:00 at processTicksAndRejections (node:internal/process/task_queues:96:5) 10/2/2022 15:45:03 10/2/2022 15:45:03> node-red-docker@2.2.0 start 10/2/2022 15:45:03> node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data" 10/2/2022 15:45:03 10/2/2022 15:45:0510 Feb 14:45:05 - [info] 10/2/2022 15:45:05 10/2/2022 15:45:05Welcome to Node-RED 10/2/2022 15:45:05=================== 10/2/2022 15:45:05 10/2/2022 15:45:0510 Feb 14:45:05 - [info] Node-RED version: v2.2.0 10/2/2022 15:45:0510 Feb 14:45:05 - [info] Node.js version: v16.13.1 10/2/2022 15:45:0510 Feb 14:45:05 - [info] Linux 4.4.0-210-generic x64 LE 10/2/2022 15:45:0510 Feb 14:45:05 - [info] Loading palette nodes 10/2/2022 15:45:0710 Feb 14:45:07 - [info] Dashboard version 3.1.5 started at /ui****

ElGranLoky commented 2 years ago

I think i found the problem.

20