0

I'm trying to load data into Meilisearch via CURL but keep getting the error:

Invalid JSON: expected value at line 1 column 1

I have run the JSON through a validator and the data pass so I decided to download the sample data from Meilisearch to double-check my own sanity (https://raw.githubusercontent.com/meilisearch/MeiliSearch/master/datasets/movies/movies.json).

The test movie.json also passes validation but when I try and load it into Meilisearch I get the same error Invalid JSON: expected value at line 1 column 1.

Is it possible my CURL request is the problem?

curl -X POST 'http://127.0.0.1:7700/indexes/products/documents' --data products.json
...
curl -X POST 'http://127.0.0.1:7700/indexes/movies/documents' --data movies.json

Steps to reproduce on Ubuntu 18.04 are as follows:

  1. Download and launch with Docker
docker run -it --rm \
    -p 7700:7700 \
    -v $(pwd)/data.ms:/data.ms \
    getmeili/meilisearch
  1. Download the sample data
curl -X GET 'https://raw.githubusercontent.com/meilisearch/MeiliSearch/master/datasets/movies/movies.json'
  1. Try and index the sample data
curl -X POST 'http://127.0.0.1:7700/indexes/movies/documents' --data movies.json
Masklinn
  • 34,759
  • 3
  • 38
  • 57
Mark
  • 151
  • 1
  • 1
  • 13

1 Answers1

0

You forgot the @ in front of your json file

try this:

curl -X POST 'http://127.0.0.1:7700/indexes/movies/documents' --data @movies.json
Bidoubiwa
  • 910
  • 2
  • 12
  • 25