Hello, All,

I can't find the way to change uniqueKey in "managed-schema" environment!!!

my steps:
1. Solr 5.3.1

/opt/solr/bin/solr start
/opt/solr/bin/solr create -c my_mail

2. added a few fields:
curl -X POST -H 'Content-type:application/json' --data-binary '{
"add-field":{"name":"sentDate", "type":"date", "indexed":true, "stored":true }, "add-field":{"name":"subject", "type":"text_general", "indexed":true, "stored":true },
...
"add-field":{"name":"flags", "type":"string", "indexed":true, "stored":true, "omitNorms":true, "multiValued":true }, "add-field":{"name":"messageId", "type":"string", "indexed":true, "stored":true, "required":true, "multiValued":"false" }, "add-field":{"name":"attachmentNames", "type":"string", "indexed":true, "stored":true, "omitNorms":true, "multiValued":true }
}' http://localhost:8983/solr/my_mail/schema

3. created according to the docs mail-data-config.xml:
<dataConfig>
  <document>
      <!--
Note - In order to index attachments, set processAttachement="true" and drop
        Tika and its dependencies to lib directory
       -->
      <entity processor="MailEntityProcessor"
            user="XXXXXXXX"
            password="XXXXXXXXX"
            host="XXXXXXXXX"
            protocol="imaps"
            fetchMailsSince="2014-06-30 00:00:00"
            batchSize="20"
            folders="INBOX"
            processAttachement="false"
            name="mail_entity"/>
  </document>
</dataConfig>

4. put libs paths and requestHandler to solrconfig.xml
...
  <lib dir="/opt/solr/contrib/dataimporthandler/lib/" regex=".*\.jar" />
  <lib dir="/opt/solr/dist/" regex="solr-dataimporthandler-.*\.jar" />
<lib dir="/opt/solr/contrib/dataimporthandler-extras/lib/" regex=".*\.jar" />
...
    <requestHandler name="/dataimport" class="solr.DataImportHandler">
      <lst name="defaults">
        <str name="config">mail-data-config.xml</str>
      </lst>
    </requestHandler>

5. try to dataimport my mailbox
and ... org.apache.solr.common.SolrException: Document is missing mandatory uniqueKey field: id

6. look at the examples in example/example-DIH/solr/mail/conf
...
 <uniqueKey>messageId</uniqueKey>
...

7. The first and the last question: the correct way changing uniqueKey in schemaless environment? what I missed?

Thanks a lot for everyone for reading and helping.

Oleksandr Yermolenko
network/systems engineer

Reply via email to