I tried it and I get the same error response! Which is because... I don't
have a field named "datasource".
You need to check the Solr schema.xml for the available fields and then add
any fields that your JSON uses that are not already there. Be sure to
shutdown and restart Solr after editing the schema.
I did notice that there is a "keywords" field, but it is not multivalued,
while you keywords are multivalued.
Or, you can us dynamic fields, such as "datasource_s" and "keywords_ss ("s"
for string and a second "s" for multivalued), etc. for your other fields.
-- Jack Krupansky
-----Original Message-----
From: Patrice Seyed
Sent: Friday, March 15, 2013 5:58 PM
To: solr-user@lucene.apache.org
Subject: status 400 on posting json
Hi all,
Running the solr server:
~/solr-4.1.0/example$ java -jar start.jar
For updating solr with json, I followed the convention at:
example/examplesdocs/books.json
which has:
[
{
"id" : "978-0641723445",^M
"cat" : ["book","hardcover"],^M
"name" : "The Lightning Thief",^M
"author" : "Rick Riordan",^M
"series_t" : "Percy Jackson and the Olympians",^M
"sequence_i" : 1,^M
"genre_s" : "fantasy",^M
"inStock" : true,^M
"price" : 12.50,^M
"pages_i" : 384^M
},
...
]
My json file is structured as follows:
[
{"id":"doi:10.6085\/AA\/CBLX00_XXXITBDXLSR01_20040221.50.4","datasource":"urn:node:PISCO","abstract":"This
metadata record describes a mix of intertidal seawater and air
temperature data collected at Cape Blanco, Oregon, USA, by PISCO.
Measurements were collected using StowAway TidbiT Temperature Loggers
(Onset Computer Corp. TBI32-05+37) beginning 2004-02-21. Site
temperature loggers are bolted down in a wire cage at three locations
within each site near MLLW. Temperature is recorded at 1 hour
intervals.","title":"PISCO: Intertidal: site temperature data: Cape
Blanco, Oregon, USA (CBLX00)","project":"Partnership for
Interdisciplinary Studies of Coastal Oceans (PISCO)","author":"Bruce
Menge","contactOrganization":["Partnership for Interdisciplinary
Studies of Coastal Oceans (PISCO)","PISCO"],"keywords":["EARTH SCIENCE
: Oceans : Ocean Temperature : Water
Temperature","Temperature","Integrated Ocean Observing
System","IOOS","Oceanographic Sensor Data","Intertidal Temperature
Data","continental shelf","seawater","temperature","Oregon","United
States of America","PISCO"]},
...
]
Per the documentation at:
http://wiki.apache.org/solr/UpdateJSON
attempted post of json with:
curl 'http://localhost:8983/solr/update/json?commit=true'
--data-binary @datafile.json -H 'Content-type:application/json'
received the following status 400:
{"responseHeader":{"status":400,"QTime":1},"error":{"msg":"ERROR:
[doc=doi:10.6073/AA/knb-lter-bes.14.45] unknown field
'datasource'","code":400}}
/Applications/MAMP/htdocs$
Is there some place I should indicate what parameters are including in
the json objects send? I was able to test books.json without the
error.
Thanks in advance,
Patrice