Tutorial example loading of exampledocs for *.xml fails due to bad request

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Tutorial example loading of exampledocs for *.xml fails due to bad request

onixterry
I am following the tutorial documentation at http://lucene.apache.org/solr/quickstart.html.  I successfully indexed the "docs" folder using the SimplePostTool (Windows, using the Java method).

When I attempt the second example, of loading the *.xml files, I receive an error back.  I tried just one of the XMLs and receive the same error.  

Here is the output:

C:\solr-5.5.0>java -Dauto -Dc=gettingstarted -jar example/exampledocs/post.jar example/exampledocs/gb18030-example.xml
SimplePostTool version 5.0.0
Posting files to [base] url http://localhost:8983/solr/gettingstarted/update...
Entering auto mode. File endings considered are xml,json,jsonl,csv,pdf,doc,docx,ppt,pptx,xls,xlsx,odt,odp,ods,ott,otp,ots,rtf,htm,html,txt,log
POSTing file gb18030-example.xml (application/xml) to [base]
SimplePostTool: WARNING: Solr returned an error #400 (Bad Request) for url: http://localhost:8983/solr/gettingstarted/update
SimplePostTool: WARNING: Response: <?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">400</int><int name="QTime">8</int></lst><lst name="error"><lst name="metadata"><str name="error-class">org.apache.solr.common.SolrException</str><str name="root-error-class">java.lang.NumberFormatException</str><str name="error-class">org.apache.solr.common.SolrException</str><str name="root-error-class">org.apache.solr.common.SolrException</str></lst><str name="msg">Bad Request



request: http://10.0.1.36:8983/solr/gettingstarted_shard1_replica2/update?update.chain=add-unknown-fields-to-the-schema&update.distrib=TOLEADER&distrib.from=http%3A%2F%2F10.0.1.36%3A8983%2Fsolr%2Fgettingstarted_shard2_replica2%2F&wt=javabin&version=2</str><int name="code">400</int></lst>
</response>
SimplePostTool: WARNING: IOException while reading response: java.io.IOException: Server returned HTTP response code: 400 for URL: http://localhost:8983/solr/gettingstarted/update
1 files indexed.
COMMITting Solr index changes to http://localhost:8983/solr/gettingstarted/update...
Time spent: 0:00:00.093

I haven't seen any online posts related to the QuickStart documentation so I am not sure where to turn for assistance.

Anyone have any suggestions?
Reply | Threaded
Open this post in threaded view
|

Re: Tutorial example loading of exampledocs for *.xml fails due to bad request

Binoy Dalal
The stack trace says that it is a number format exception, which means that
some field which is expecting a numeric value is receiving a non-numeric
value.

You should check you schema for all the fields pertaining to these docs
which are numeric and check those against the docs themselves to ensure
that those fields in the docs contain numeric values.

On Mon, 4 Apr 2016, 19:14 onixterry, <[hidden email]> wrote:

> I am following the tutorial documentation at
> http://lucene.apache.org/solr/quickstart.html
> <http://lucene.apache.org/solr/quickstart.html>  .  I successfully indexed
> the "docs" folder using the SimplePostTool (Windows, using the Java
> method).
>
> When I attempt the second example, of loading the *.xml files, I receive an
> error back.  I tried just one of the XMLs and receive the same error.
>
> Here is the output:
>
> C:\solr-5.5.0>java -Dauto -Dc=gettingstarted -jar
> example/exampledocs/post.jar example/exampledocs/gb18030-example.xml
> SimplePostTool version 5.0.0
> Posting files to [base] url
> http://localhost:8983/solr/gettingstarted/update...
> Entering auto mode. File endings considered are
>
> xml,json,jsonl,csv,pdf,doc,docx,ppt,pptx,xls,xlsx,odt,odp,ods,ott,otp,ots,rtf,htm,html,txt,log
> POSTing file gb18030-example.xml (application/xml) to [base]
> SimplePostTool: WARNING: Solr returned an error #400 (Bad Request) for url:
> http://localhost:8983/solr/gettingstarted/update
> SimplePostTool: WARNING: Response: <?xml version="1.0" encoding="UTF-8"?>
> <response>
> <lst name="responseHeader"><int name="status">400</int><int
> name="QTime">8</int></lst><lst name="error"><lst name="metadata"><str
> name="error-class">org.apache.solr.common.SolrException</str><str
> name="root-error-class">java.lang.NumberFormatException</str><str
> name="error-class">org.apache.solr.common.SolrException</str><str
>
> name="root-error-class">org.apache.solr.common.SolrException</str></lst><str
> name="msg">Bad Request
>
>
>
> request:
>
> http://10.0.1.36:8983/solr/gettingstarted_shard1_replica2/update?update.chain=add-unknown-fields-to-the-schema&amp;update.distrib=TOLEADER&amp;distrib.from=http%3A%2F%2F10.0.1.36%3A8983%2Fsolr%2Fgettingstarted_shard2_replica2%2F&amp;wt=javabin&amp;version=2
> </str><int
> name="code">400</int></lst>
> </response>
> SimplePostTool: WARNING: IOException while reading response:
> java.io.IOException: Server returned HTTP response code: 400 for URL:
> http://localhost:8983/solr/gettingstarted/update
> 1 files indexed.
> COMMITting Solr index changes to
> http://localhost:8983/solr/gettingstarted/update...
> Time spent: 0:00:00.093
>
> I haven't seen any online posts related to the QuickStart documentation so
> I
> am not sure where to turn for assistance.
>
> Anyone have any suggestions?
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Tutorial-example-loading-of-exampledocs-for-xml-fails-due-to-bad-request-tp4267878.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
--
Regards,
Binoy Dalal
Reply | Threaded
Open this post in threaded view
|

Re: Tutorial example loading of exampledocs for *.xml fails due to bad request

onixterry
OK, but this content was provided by the people who created the tutorial.   Perhaps there is a change in the recent release as the data files need to be modified to work?  The tutorial says it is for Solr 5.3 and I am using 5.5.

The XML files all seem very simple.  Example:

<add>
<doc>
  <field name="id">SP2514N</field>
  <field name="name">Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133</field>
  <field name="manu">Samsung Electronics Co. Ltd.</field>
 
  <field name="manu_id_s">samsung</field>
  <field name="cat">electronics</field>
  <field name="cat">hard drive</field>
  <field name="features">7200RPM, 8MB cache, IDE Ultra ATA-133</field>
  <field name="features">NoiseGuard, SilentSeek technology, Fluid Dynamic Bearing (FDB) motor</field>
  <field name="price">92.0</field>
  <field name="popularity">6</field>
  <field name="inStock">true</field>
  <field name="manufacturedate_dt">2006-02-13T15:26:37Z</field>
 
  <field name="store">35.0752,-97.032</field>
</doc>

<doc>
  <field name="id">6H500F0</field>
  <field name="name">Maxtor DiamondMax 11 - hard drive - 500 GB - SATA-300</field>
  <field name="manu">Maxtor Corp.</field>
 
  <field name="manu_id_s">maxtor</field>
  <field name="cat">electronics</field>
  <field name="cat">hard drive</field>
  <field name="features">SATA 3.0Gb/s, NCQ</field>
  <field name="features">8.5ms seek</field>
  <field name="features">16MB cache</field>
  <field name="price">350.0</field>
  <field name="popularity">6</field>
  <field name="inStock">true</field>
 
  <field name="store">45.17614,-93.87341</field>
  <field name="manufacturedate_dt">2006-02-13T15:26:37Z</field>
</doc>
</add>

Reply | Threaded
Open this post in threaded view
|

Re: Tutorial example loading of exampledocs for *.xml fails due to bad request

Binoy Dalal
You should check the logs. They'll tell you the exact fields that pose a
problem in this case.

On Mon, 4 Apr 2016, 19:22 onixterry, <[hidden email]> wrote:

> OK, but this content was provided by the people who created the tutorial.
> Perhaps there is a change in the recent release as the data files need to
> be
> modified to work?  The tutorial says it is for Solr 5.3 and I am using 5.5.
>
> The XML files all seem very simple.  Example:
>
> <add>
> <doc>
>   <field name="id">SP2514N</field>
>   <field name="name">Samsung SpinPoint P120 SP2514N - hard drive - 250 GB -
> ATA-133</field>
>   <field name="manu">Samsung Electronics Co. Ltd.</field>
>
>   <field name="manu_id_s">samsung</field>
>   <field name="cat">electronics</field>
>   <field name="cat">hard drive</field>
>   <field name="features">7200RPM, 8MB cache, IDE Ultra ATA-133</field>
>   <field name="features">NoiseGuard, SilentSeek technology, Fluid Dynamic
> Bearing (FDB) motor</field>
>   <field name="price">92.0</field>
>   <field name="popularity">6</field>
>   <field name="inStock">true</field>
>   <field name="manufacturedate_dt">2006-02-13T15:26:37Z</field>
>
>   <field name="store">35.0752,-97.032</field>
> </doc>
>
> <doc>
>   <field name="id">6H500F0</field>
>   <field name="name">Maxtor DiamondMax 11 - hard drive - 500 GB -
> SATA-300</field>
>   <field name="manu">Maxtor Corp.</field>
>
>   <field name="manu_id_s">maxtor</field>
>   <field name="cat">electronics</field>
>   <field name="cat">hard drive</field>
>   <field name="features">SATA 3.0Gb/s, NCQ</field>
>   <field name="features">8.5ms seek</field>
>   <field name="features">16MB cache</field>
>   <field name="price">350.0</field>
>   <field name="popularity">6</field>
>   <field name="inStock">true</field>
>
>   <field name="store">45.17614,-93.87341</field>
>   <field name="manufacturedate_dt">2006-02-13T15:26:37Z</field>
> </doc>
> </add>
>
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Tutorial-example-loading-of-exampledocs-for-xml-fails-due-to-bad-request-tp4267878p4267881.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
--
Regards,
Binoy Dalal
Reply | Threaded
Open this post in threaded view
|

Re: Tutorial example loading of exampledocs for *.xml fails due to bad request

Chris Hostetter-3
In reply to this post by onixterry

: When I attempt the second example, of loading the *.xml files, I receive an
: error back.  I tried just one of the XMLs and receive the same error.  

Yeah ... there's a poor assumption here in the tutorial.  note in
particular this paragraph...

--SNIP--
Solr's install includes a handful of Solr XML formatted files with example
data (mostly mocked tech product data). NOTE: This tech product data has a
more domain-specific configuration, including schema and browse UI. The
bin/solr script includes built-in support for this by running bin/solr
start -e techproducts which not only starts Solr but also then indexes
this data too (be sure to bin/solr stop -all before trying it out).
However, the example below assumes Solr was started with bin/solr start -e
cloud to stay consistent with all examples on this page, and thus the
collection used is "gettingstarted", not "techproducts".
--SNIP--

If you use "bin/solr start -e techproducts" (or explicitly create a solr
collection using the "sample_techproducts" config set) then those
documents will index just fine -- but the assumption written here in the
tutorial that you can index those tech product documents to the same
gettingstarted collection you've been indexing to earlier in the tutorial
is definitely flawed -- the fieldtype deduction logic that's applied for
the gettingstarted collection (and the specific type deduced from the
earlier docs) won't neccessarily apply to the sample tech product
documents.

https://issues.apache.org/jira/browse/SOLR-8943


-Hoss
http://www.lucidworks.com/
Reply | Threaded
Open this post in threaded view
|

Re: Tutorial example loading of exampledocs for *.xml fails due to bad request

onixterry
Ah, ok.  I was just figuring that out when I stripped everything down to two fields and it was still failing until I put a numeric value in a field called "name".

Thanks