views:

131

answers:

1

I have set up Solr and am trying to index a simple 2 column, 2 row table (MySQL 'test_tb' tabe within database 'test_db') with (first column) unique id (in the mysql of type int) and (second column) some text. I keep getting the error:

WARNING: Error creating document : SolrInputDocument[{ID_F=ID_F(1.0)={1}}]
org.apache.solr.common.SolrException: Document [null] missing required field: id

What does this mean? Please help.

schema.xml

<fields>
    <field name="ID_F" type="string" indexed="true" stored="true" required="false"/>
    <field name="COLA" type="string" indexed="true" stored="true" required="false"/>
 </fields>

data-config.xml

<dataConfig>
<dataSource type="JdbcDataSource"
              driver="com.mysql.jdbc.Driver"
              url="jdbc:mysql://localhost/test_db"
              user="root"
              password="root_pwd"/>

<document name="doc">

<entity name="test_tb" query="select ID_F,COLA from test_tb">
        <field column="ID_F" name="ID_F" />
        <field column="COLA" name="COLA" />
</entity>

</document>
</dataConfig>
A: 

In your schema you probably defined a required field named "id". Either you rename ID_F to id <field column="ID_F" name="id" />or change the value in your schema.

Jem