zincsearch / zincsearch

ZincSearch . A lightweight alternative to elasticsearch that requires minimal resources, written in Go.

Home Page:https://zincsearch-docs.zinc.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Observation - Receive 500 internal error on inserting key with null value

gorazdg opened this issue · comments

Maybe this is more observation, but still - when particular value is null, I receive 500. I do not know what would be correct behaviour, ESS survives exactly this scenario.

When for particular key "null" value is assigned on indexing.
As:

185	3.377123217	127.0.0.1	127.0.0.1	HTTP	505	POST /es/product_v2/_doc HTTP/1.1  (application/json)

{"product_id":"eabf69fbe53f57a4ef6fabd6af8430ba","product_type":"car","car_manufacturer":null,"car_model":"\"VOLUNTEER 4X2\"","car_year":"2011","car_gear_type":null,"weight":0}

I received back: 500 Internal error with following output from zinc:

2021/12/28 18:00:38 [Recovery] 2021/12/28 - 18:00:38 panic recovered:
POST /es/product_v2/_doc HTTP/1.1
Host: localhost:4080
Accept: application/json
Authorization: *
Content-Length: 176
Content-Type: application/json
User-Agent: elasticsearch-php/6.7.1 (Linux 5.11.0-43-generic, PHP 7.4.3)

interface conversion: interface {} is string, not float64
/usr/local/go/src/runtime/iface.go:261 (0x40a374)
/Users/prabhat/projects/zinc/zinc/pkg/core/Index.go:77 (0x957df4)
/Users/prabhat/projects/zinc/zinc/pkg/core/UpdateDocument.go:5 (0x95a1a6)
/Users/prabhat/projects/zinc/zinc/pkg/handlers/UpdateDocument.go:47 (0x96de96)
/Users/prabhat/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/context.go:165 (0x967c27)
/Users/prabhat/projects/zinc/zinc/pkg/auth/AuthMiddleware.go:21 (0x967a6e)
/Users/prabhat/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/context.go:165 (0x891fa1)
/Users/prabhat/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/recovery.go:99 (0x891f8c)
/Users/prabhat/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/context.go:165 (0x890e5d)
/Users/prabhat/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/gin.go:489 (0x890ae5)
/Users/prabhat/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/gin.go:445 (0x890644)
/usr/local/go/src/net/http/server.go:2879 (0x668eda)
/usr/local/go/src/net/http/server.go:1930 (0x664587)
/usr/local/go/src/runtime/asm_amd64.s:1581 (0x463580)

Looks like you are using ES SDK which is incompatible with zinc.

null is handled well in zinc.

Try this.

curl -u admin:Complexpass#123 -XPOST -d '{"product_id":"eabf69fbe53f57a4ef6fabd6af8430ba","product_type":"car","car_manufacturer":null,"car_model":"\"VOLUNTEER 4X2\"","car_year":"2011","car_gear_type":null,"weight":0}' http://localhost:4080/es/product_v2/_doc

@prabhatsharma actually is same - since I forgot to mention one important detail - this particular field which is supposed to have null indexed is already populated with string values from previous index requests.


$ curl -v -u admin:AdminPassword -POST -d '{"product_id":"eabf69fbe53f57a4ef6fabd6af8430ba","product_type":"car","car_manufacturer":null,"car_model":"\"VOLUNTEER 4X2\"","car_year":"2011","car_gear_type":null,"weight":0}' http://localhost:4080/es/product_v2/_doc
*   Trying 127.0.0.1:4080...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 4080 (#0)
* Server auth using Basic with user 'admin'
> POST /es/product_v2/_doc HTTP/1.1
> Host: localhost:4080
> Authorization: Basic YWRtaW46QWRtaW5QYXNzd29yZA==
> User-Agent: curl/7.68.0
> Accept: */*
> Content-Length: 176
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 176 out of 176 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 500 Internal Server Error
< Date: Wed, 29 Dec 2021 16:03:51 GMT
< Content-Length: 0
< 
* Connection #0 to host localhost left intact

and on zinc side:


{"level":"debug","time":"2021-12-29T17:03:51+01:00","message":"auth: success"}


2021/12/29 17:03:51 [Recovery] 2021/12/29 - 17:03:51 panic recovered:
POST /es/product_v2/_doc HTTP/1.1
Host: localhost:4080
Accept: */*
Authorization: *
Content-Length: 176
Content-Type: application/x-www-form-urlencoded
User-Agent: curl/7.68.0


interface conversion: interface {} is string, not float64
/usr/local/go/src/runtime/iface.go:261 (0x40a374)
/Users/prabhat/projects/zinc/zinc/pkg/core/Index.go:77 (0x957df4)
/Users/prabhat/projects/zinc/zinc/pkg/core/UpdateDocument.go:5 (0x95a1a6)
/Users/prabhat/projects/zinc/zinc/pkg/handlers/UpdateDocument.go:47 (0x96de96)
/Users/prabhat/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/context.go:165 (0x967c27)
/Users/prabhat/projects/zinc/zinc/pkg/auth/AuthMiddleware.go:21 (0x967a6e)
/Users/prabhat/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/context.go:165 (0x891fa1)
/Users/prabhat/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/recovery.go:99 (0x891f8c)
/Users/prabhat/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/context.go:165 (0x890e5d)
/Users/prabhat/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/gin.go:489 (0x890ae5)
/Users/prabhat/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/gin.go:445 (0x890644)
/usr/local/go/src/net/http/server.go:2879 (0x668eda)
/usr/local/go/src/net/http/server.go:1930 (0x664587)
/usr/local/go/src/runtime/asm_amd64.s:1581 (0x463580)

Ah got it. I will take a look at it soon.

which version did you test on?
i test on:
commit: 9e18369

there is no this problem.

@gorazdg I tried with the latest release and could not replicate the issue. I see that @safeie has the same observation. Can you please check with the latest release and confirm if you are still facing the issue.

@gorazdg Are you still having trouble around this?

Closing this is non-reproducible. Please reopen if needed.