You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by matt corkum <co...@gmail.com> on 2016/08/19 12:06:08 UTC
posting to Solr 6.0.0
Hi —
I looking for a way to send many JSON files to a Classic Index Schema (not managed) using something.
I created a schema.xml and a solrconfig.xml that allows me to post JSON using the Solr Admin document
Using <schemaFactory class="ClassicIndexSchemaFactory"/> in solrconfig.xml, so it’s not managed schema.
Post my JSON (below) to the Solr Admin post a document—> http://localhost:8983/solr/#/poc2/documents <http://localhost:8983/solr/#/poc2/documents> WORKS ! (creates a field / value for each of the tuples below)
So this assumes the schema.xml is valid and working I get a multiple valued field.
however when I use the bin/post tool or curl POST doing this (they both produce only id, all, _src_, and _version_). The _src_ has my original document below.
Anyone have a suggestion on the proper use of curl or the Solr post tool properly (Data Handler?) to post a directory of JSON?
Do I need to adjust my solrconfig.xml to make something work.
Thank you
Here is a sample curl
curl -X POST -H 'Content-Type: application/json' 'http://localhost:8983/solr/poc2/update/json/docs' <http://localhost:8983/solr/poc2/update/json/docs'> --data-binary '
{
"eid": "1-s2.0-S073510971104383X",
"contentsubtype": "PGL",
"issn": "07351097",
"all": "JACC (Journal of the American College of Cardiology) 2011 ACCF/AHA Guideline for the Diagnosis and Treatment of Hypertrop\
hic Cardiomyopathy: Executive Summary Recommendations for HCM Stress Testing—Recommendations 2.4 Class IIa 1 Treadmill exercise te\
sting is reasonable to determine functional capacity and response to therapy in patients with HCM. (Level of Evidence: C) 2 Treadm\
ill testing with monitoring of an ECG and blood pressure is reasonable for SCD risk stratification in patients with HCM ( 69–71 ).\
(Level of Evidence: B) 3 In patients with HCM who do not have a resting peak instantaneous gradient of greater than or equal to 5\
0 mm Hg, exercise echocardiography is reasonable for the detection and quantification of exercise-induced dynamic LVOT obstruction\
( 67,70–72 ). (Level of Evidence: B)",
}’
here is a sample Solr post: ~/solr-6.0.0/bin/post -c poc2 . (done in the directory of JSON or it’s parent) — all docs are visited and sent to the Solr index (only getting the id, _src_, all, and _version_ fields.
I appreciate any comments on what might need adjustment.
I will see about reverse engineering the POST of the Solr Admin to discover the post of the JSON (it has to be different in some manner).
Thank you
Matt
Re: posting to Solr 6.0.0
Posted by matt corkum <co...@gmail.com>.
I managed to solve this with the following approach.
create core ~/Downloads/solr-6.0.0/bin/solr create -c poc5
use the schema API of Solr 6.0.0 & push the schema style for each field (I have a few fields)
Here is one example of changing the “all" field
curl -X POST -H 'Content-type:application/json' --data-binary '{"add-field":{"name”:"all" ,"type":"text_en", "stored”:"true","indexed”:”true”, "multiVauled”:”true"} }' http://localhost:8983/solr/poc5/schema <http://localhost:8983/solr/poc5/schema>
Post the docs once the schema is defined
~/Downloads/solr-6.0.0/bin/post -c poc5 .
I now get multiple valued fields and the type of processing I want.
I bet there is an easier way, but this is working !
Thanks
Matt
> On Aug 19, 2016, at 8:06 AM, matt corkum <co...@gmail.com> wrote:
>
> Hi —
>
> I looking for a way to send many JSON files to a Classic Index Schema (not managed) using something.
>
> I created a schema.xml and a solrconfig.xml that allows me to post JSON using the Solr Admin document
> Using <schemaFactory class="ClassicIndexSchemaFactory"/> in solrconfig.xml, so it’s not managed schema.
>
> Post my JSON (below) to the Solr Admin post a document—> http://localhost:8983/solr/#/poc2/documents <http://localhost:8983/solr/#/poc2/documents> WORKS ! (creates a field / value for each of the tuples below)
> So this assumes the schema.xml is valid and working I get a multiple valued field.
>
> however when I use the bin/post tool or curl POST doing this (they both produce only id, all, _src_, and _version_). The _src_ has my original document below.
>
> Anyone have a suggestion on the proper use of curl or the Solr post tool properly (Data Handler?) to post a directory of JSON?
> Do I need to adjust my solrconfig.xml to make something work.
>
> Thank you
>
> Here is a sample curl
>
> curl -X POST -H 'Content-Type: application/json' 'http://localhost:8983/solr/poc2/update/json/docs' <http://localhost:8983/solr/poc2/update/json/docs'> --data-binary '
> {
> "eid": "1-s2.0-S073510971104383X",
> "contentsubtype": "PGL",
> "issn": "07351097",
> "all": "JACC (Journal of the American College of Cardiology) 2011 ACCF/AHA Guideline for the Diagnosis and Treatment of Hypertrop\
> hic Cardiomyopathy: Executive Summary Recommendations for HCM Stress Testing—Recommendations 2.4 Class IIa 1 Treadmill exercise te\
> sting is reasonable to determine functional capacity and response to therapy in patients with HCM. (Level of Evidence: C) 2 Treadm\
> ill testing with monitoring of an ECG and blood pressure is reasonable for SCD risk stratification in patients with HCM ( 69–71 ).\
> (Level of Evidence: B) 3 In patients with HCM who do not have a resting peak instantaneous gradient of greater than or equal to 5\
> 0 mm Hg, exercise echocardiography is reasonable for the detection and quantification of exercise-induced dynamic LVOT obstruction\
> ( 67,70–72 ). (Level of Evidence: B)",
>
> }’
>
> here is a sample Solr post: ~/solr-6.0.0/bin/post -c poc2 . (done in the directory of JSON or it’s parent) — all docs are visited and sent to the Solr index (only getting the id, _src_, all, and _version_ fields.
>
> I appreciate any comments on what might need adjustment.
>
> I will see about reverse engineering the POST of the Solr Admin to discover the post of the JSON (it has to be different in some manner).
>
> Thank you
> Matt