mosuka / blast

Blast is a full text search and indexing server, written in Go, built on top of Bleve.
Apache License 2.0
1.08k stars 76 forks source link

REST structure #5

Closed fils closed 6 years ago

fils commented 6 years ago

So I want to load into Blast using my own go RESTful client code.

In your example

$ cat ./example/document_1.json | xargs -0 ./bin/blast put document --request

I see we are doing a PUT to 0.0.0.0:8000/rest/ID where ID is the ID of the document.

However, how is the JSON document sent in that PUT command? Is this a BODY only or is there an association that needs to take place. I have used the HTTPie package with

http -v -j PUT 0.0.0.0:8000/rest/1 @sodataset.json

but it comes back 400 bad request. If we are using HTTPie or curl what would a PUT command look like?

I'm trying to load 50K JSON-LD documents (schema.org) from Minio into Blast.

Thanks! Doug

fils commented 6 years ago

I think I may have figured it out looking at the source...

I didn't realize the JSON needed to be wrapped in "document" like in

{
    "document" : {
    "fields": {
        "category": "Library",
        "description": "Bleve is a full-text search and indexing library for Go.",
        "name": "Bleve",
        "popularity": 3.0,
        "release": "2014-04-18T00:00:00Z",
        "type": "document"
    },
    "id": "1"
    }
}
mosuka commented 6 years ago

@fils Sorry for the late reply. I was working on recreate Blast. I committed new code, please try v0.1.0 if you have time.

mosuka commented 6 years ago

Hi @fils

I close this issue. If you haven't resolve, please reopen this issue or create new issue. Thank you for your report!