org.apache.solr.common.SolrException: Document is missing mandatory uniqueKey field: id
<p>I have run Ａpache solr 6.1.0 successfully. I have also created new core named "Testcore" and add all the required files solrconfig.xml, schema.xml in the solr\Testcore folder. </p>

<p>Now I have run following command in command prompt for indexing an csv file :</p>

<pre><code>C:\&gt;java -Durl=http://localhost:8983/solr/Testcore/update/csv -Dtype=text/csv -jar C:\solr-6.1.0\server\lib/post.jar C:\messages\TestInsert-08-16-2016-15-47-solr.csv
</code></pre>

<p>Now while indexing an csv file i am getting following error response code in command prompt :</p>

<pre><code>SimplePostTool version 5.0.0
Posting files to [base] url http://localhost:8983/solr/Testcore/update/csv usin
g content-type text/csv...
POSTing file TestInsert-08-16-2016-15-47-solr.csv to [base]
SimplePostTool: WARNING: Solr returned an error #400 (Bad Request) for url: http
://localhost:8983/solr/Testcore/update/csv
SimplePostTool: WARNING: Response: &lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;response&gt;
&lt;lst name="responseHeader"&gt;&lt;int name="status"&gt;400&lt;/int&gt;&lt;int name="QTime"&gt;27&lt;/int
&gt;&lt;/lst&gt;&lt;lst name="error"&gt;&lt;lst name="metadata"&gt;&lt;str name="error-class"&gt;org.apache
.solr.common.SolrException&lt;/str&gt;&lt;str name="root-error-class"&gt;org.apache.solr.common.SolrException&lt;/str&gt;&lt;/lst&gt;&lt;str name="msg"&gt;Document is missing mandatory uniqueKey field: id&lt;/str&gt;&lt;int name="code"&gt;400&lt;/int&gt;&lt;/lst&gt;
&lt;/response&gt;
SimplePostTool: WARNING: IOException while reading response: java.io.IOException
: Server returned HTTP response code: 400 for URL: http://localhost:8983/solr/Testcore/update/csv
1 files indexed.
COMMITting Solr index changes to http://localhost:8983/solr/Testcore/update/csv
...
Time spent: 0:00:00.073 
</code></pre>

<p>So In the response code it returns error msg as "Document is missing mandatory uniqueKey field: id". Also data is not getting indexed on solr site due to that error.</p>

<p>My schema.xml file :</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;

&lt;schema name="example" version="1.5"&gt;

   &lt;field name="_version_" type="long" indexed="true" stored="true"/&gt;


   &lt;field name="_root_" type="string" indexed="true" stored="false"/&gt;


   &lt;field name="id" type="string" indexed="true" stored="true" required="true" /&gt; 


   &lt;field name="sku" type="text_en_splitting_tight" indexed="true" stored="true" omitNorms="true"/&gt;
   &lt;field name="name" type="text_general" indexed="true" stored="true"/&gt;
   &lt;field name="manu" type="text_general" indexed="true" stored="true" omitNorms="true"/&gt;
   &lt;field name="cat" type="string" indexed="true" stored="true" multiValued="true"/&gt;
   &lt;field name="features" type="text_general" indexed="true" stored="true" multiValued="true"/&gt;
   &lt;field name="includes" type="text_general" indexed="true" stored="true" termVectors="true" termPositions="true" termOffsets="true" /&gt;

   &lt;field name="weight" type="float" indexed="true" stored="true"/&gt;
   &lt;field name="price"  type="float" indexed="true" stored="true"/&gt;
   &lt;field name="popularity" type="int" indexed="true" stored="true" /&gt;
   &lt;field name="inStock" type="boolean" indexed="true" stored="true" /&gt;

   &lt;field name="store" type="location" indexed="true" stored="true"/&gt;


   &lt;field name="title" type="text_general" indexed="true" stored="true" multiValued="true"/&gt;
   &lt;field name="subject" type="text_general" indexed="true" stored="true"/&gt;
   &lt;field name="description" type="text_general" indexed="true" stored="true"/&gt;
   &lt;field name="comments" type="text_general" indexed="true" stored="true"/&gt;
   &lt;field name="author" type="text_general" indexed="true" stored="true"/&gt;
   &lt;field name="keywords" type="text_general" indexed="true" stored="true"/&gt;
   &lt;field name="category" type="text_general" indexed="true" stored="true"/&gt;
   &lt;field name="resourcename" type="text_general" indexed="true" stored="true"/&gt;
   &lt;field name="url" type="text_general" indexed="true" stored="true"/&gt;
   &lt;field name="content_type" type="string" indexed="true" stored="true" multiValued="true"/&gt;
   &lt;field name="last_modified" type="date" indexed="true" stored="true"/&gt;
   &lt;field name="links" type="string" indexed="true" stored="true" multiValued="true"/&gt;


  &lt;!-- Testcore  spcific fields --&gt;


&lt;field name="SRNO" type="int" indexed="true" stored="true"/&gt; 
&lt;field name="IDENTIFIER" type="string" indexed="true" stored="true"/&gt;
&lt;field name="AGENTID" type="string" indexed="true" stored="true"/&gt;
&lt;field name="AGENTNAME" type="string" indexed="true" stored="true"/&gt;

&lt;field name="event_timestamp" type="date" indexed="true" stored="true" default="NOW" multiValued="false"/&gt;
&lt;field name="MONTH" type="string" indexed="true" stored="true"/&gt;
&lt;field name="DAY" type="string" indexed="true" stored="true"/&gt;
&lt;field name="TIMESTAMP" type="string" indexed="true" stored="true"/&gt;
&lt;field name="TYPE" type="string" indexed="true" stored="true"/&gt;
&lt;field name="TASKID" type="string" indexed="true" stored="true"/&gt;

&lt;!-- End of Testcore fields-----&gt;

     &lt;field name="content" type="text_general" indexed="false" stored="true" multiValued="true"/&gt;
     &lt;field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/&gt;
     &lt;field name="text_rev" type="text_general_rev" indexed="true" stored="false" multiValued="true"/&gt;
     &lt;field name="manu_exact" type="string" indexed="true" stored="false"/&gt;
   &lt;field name="payloads" type="payloads" indexed="true" stored="true"/&gt;

   &lt;dynamicField name="*_i"  type="int"    indexed="true"  stored="true"/&gt;
   &lt;dynamicField name="*_is" type="int"    indexed="true"  stored="true"  multiValued="true"/&gt;
   &lt;dynamicField name="*_s"  type="string"  indexed="true"  stored="true" /&gt;
   &lt;dynamicField name="*_ss" type="string"  indexed="true"  stored="true" multiValued="true"/&gt;
   &lt;dynamicField name="*_l"  type="long"   indexed="true"  stored="true"/&gt;
   &lt;dynamicField name="*_ls" type="long"   indexed="true"  stored="true"  multiValued="true"/&gt;
   &lt;dynamicField name="*_t"  type="text_general"    indexed="true"  stored="true"/&gt;
   &lt;dynamicField name="*_txt" type="text_general"   indexed="true"  stored="true" multiValued="true"/&gt;
   &lt;dynamicField name="*_en"  type="text_en"    indexed="true"  stored="true" multiValued="true"/&gt;
   &lt;dynamicField name="*_b"  type="boolean" indexed="true" stored="true"/&gt;
   &lt;dynamicField name="*_bs" type="boolean" indexed="true" stored="true"  multiValued="true"/&gt;
   &lt;dynamicField name="*_f"  type="float"  indexed="true"  stored="true"/&gt;
   &lt;dynamicField name="*_fs" type="float"  indexed="true"  stored="true"  multiValued="true"/&gt;
   &lt;dynamicField name="*_d"  type="double" indexed="true"  stored="true"/&gt;
   &lt;dynamicField name="*_ds" type="double" indexed="true"  stored="true"  multiValued="true"/&gt;

   &lt;!-- Type used to index the lat and lon components for the "location" FieldType --&gt;
   &lt;dynamicField name="*_coordinate"  type="tdouble" indexed="true"  stored="false" /&gt;

   &lt;dynamicField name="*_dt"  type="date"    indexed="true"  stored="true"/&gt;
   &lt;dynamicField name="*_dts" type="date"    indexed="true"  stored="true" multiValued="true"/&gt;
   &lt;dynamicField name="*_p"  type="location" indexed="true" stored="true"/&gt;

   &lt;!-- some trie-coded dynamic fields for faster range queries --&gt;
   &lt;dynamicField name="*_ti" type="tint"    indexed="true"  stored="true"/&gt;
   &lt;dynamicField name="*_tl" type="tlong"   indexed="true"  stored="true"/&gt;
   &lt;dynamicField name="*_tf" type="tfloat"  indexed="true"  stored="true"/&gt;
   &lt;dynamicField name="*_td" type="tdouble" indexed="true"  stored="true"/&gt;
   &lt;dynamicField name="*_tdt" type="tdate"  indexed="true"  stored="true"/&gt;

   &lt;dynamicField name="*_c"   type="currency" indexed="true"  stored="true"/&gt;

   &lt;dynamicField name="ignored_*" type="ignored" multiValued="true"/&gt;
   &lt;dynamicField name="attr_*" type="text_general" indexed="true" stored="true" multiValued="true"/&gt;

   &lt;dynamicField name="random_*" type="random" /&gt;




 &lt;!-- Field to use to determine and enforce document uniqueness. 
      Unless this field is marked with required="false", it will be a required field
   --&gt;
   &lt;uniqueKey&gt;id&lt;/uniqueKey&gt;


   &lt;copyField source="cat" dest="text"/&gt;
   &lt;copyField source="name" dest="text"/&gt;
   &lt;copyField source="manu" dest="text"/&gt;
   &lt;copyField source="features" dest="text"/&gt;
   &lt;copyField source="includes" dest="text"/&gt;
   &lt;copyField source="manu" dest="manu_exact"/&gt;

   &lt;!-- Copy the price into a currency enabled field (default USD) --&gt;
   &lt;copyField source="price" dest="price_c"/&gt;

   &lt;!-- Text fields from SolrCell to search by default in our catch-all field --&gt;
   &lt;copyField source="title" dest="text"/&gt;
   &lt;copyField source="author" dest="text"/&gt;
   &lt;copyField source="description" dest="text"/&gt;
   &lt;copyField source="keywords" dest="text"/&gt;
   &lt;copyField source="content" dest="text"/&gt;
   &lt;copyField source="content_type" dest="text"/&gt;
   &lt;copyField source="resourcename" dest="text"/&gt;
   &lt;copyField source="url" dest="text"/&gt;

   &lt;!-- Create a string version of author for faceting --&gt;
   &lt;copyField source="author" dest="author_s"/&gt;

     &lt;fieldType name="string" class="solr.StrField" sortMissingLast="true" /&gt;
    &lt;fieldType name="uuid" class="solr.UUIDField" indexed="true" /&gt;

    &lt;!-- boolean type: "true" or "false" --&gt;
    &lt;fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/&gt;


    &lt;fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/&gt;
    &lt;fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/&gt;
    &lt;fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/&gt;
    &lt;fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/&gt;


    &lt;fieldType name="tint" class="solr.TrieIntField" precisionStep="8" positionIncrementGap="0"/&gt;
    &lt;fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" positionIncrementGap="0"/&gt;
    &lt;fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" positionIncrementGap="0"/&gt;
    &lt;fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0"/&gt;


    &lt;fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/&gt;

    &lt;!-- A Trie based date field for faster date range queries and date faceting. --&gt;
    &lt;fieldType name="tdate" class="solr.TrieDateField" precisionStep="6" positionIncrementGap="0"/&gt;


    &lt;!--Binary data type. The data should be sent/retrieved in as Base64 encoded Strings --&gt;
    &lt;fieldtype name="binary" class="solr.BinaryField"/&gt;


    &lt;fieldType name="random" class="solr.RandomSortField" indexed="true" /&gt;



    &lt;fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100"&gt;
      &lt;analyzer&gt;
        &lt;tokenizer class="solr.WhitespaceTokenizerFactory"/&gt;
      &lt;/analyzer&gt;
    &lt;/fieldType&gt;

    &lt;fieldType name="managed_en" class="solr.TextField" positionIncrementGap="100"&gt;
      &lt;analyzer&gt;
        &lt;tokenizer class="solr.StandardTokenizerFactory"/&gt;
        &lt;filter class="solr.ManagedStopFilterFactory" managed="english" /&gt;
        &lt;filter class="solr.ManagedSynonymFilterFactory" managed="english" /&gt;
      &lt;/analyzer&gt;
    &lt;/fieldType&gt;


    &lt;fieldType name="text_general" class="solr.TextField" positionIncrementGap="100"&gt;
      &lt;analyzer type="index"&gt;
        &lt;tokenizer class="solr.StandardTokenizerFactory"/&gt;
        &lt;filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" /&gt;

        &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
      &lt;/analyzer&gt;
      &lt;analyzer type="query"&gt;
        &lt;tokenizer class="solr.StandardTokenizerFactory"/&gt;
        &lt;filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" /&gt;
        &lt;filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/&gt;
        &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
      &lt;/analyzer&gt;
    &lt;/fieldType&gt;

       &lt;fieldType name="text_en" class="solr.TextField" positionIncrementGap="100"&gt;
      &lt;analyzer type="index"&gt;
        &lt;tokenizer class="solr.StandardTokenizerFactory"/&gt;

    &lt;filter class="solr.StopFilterFactory"
                ignoreCase="true"
                words="lang/stopwords_en.txt"
                /&gt;
        &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
    &lt;filter class="solr.EnglishPossessiveFilterFactory"/&gt;
        &lt;filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/&gt;

        &lt;filter class="solr.PorterStemFilterFactory"/&gt;
      &lt;/analyzer&gt;
      &lt;analyzer type="query"&gt;
        &lt;tokenizer class="solr.StandardTokenizerFactory"/&gt;
        &lt;filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/&gt;
        &lt;filter class="solr.StopFilterFactory"
                ignoreCase="true"
                words="lang/stopwords_en.txt"
                /&gt;
        &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
    &lt;filter class="solr.EnglishPossessiveFilterFactory"/&gt;
        &lt;filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/&gt;

        &lt;filter class="solr.PorterStemFilterFactory"/&gt;
      &lt;/analyzer&gt;
    &lt;/fieldType&gt;


    &lt;fieldType name="text_en_splitting" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true"&gt;
      &lt;analyzer type="index"&gt;
        &lt;tokenizer class="solr.WhitespaceTokenizerFactory"/&gt;

        &lt;filter class="solr.StopFilterFactory"
                ignoreCase="true"
                words="lang/stopwords_en.txt"
                /&gt;
        &lt;filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/&gt;
        &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
        &lt;filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/&gt;
        &lt;filter class="solr.PorterStemFilterFactory"/&gt;
      &lt;/analyzer&gt;
      &lt;analyzer type="query"&gt;
        &lt;tokenizer class="solr.WhitespaceTokenizerFactory"/&gt;
        &lt;filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/&gt;
        &lt;filter class="solr.StopFilterFactory"
                ignoreCase="true"
                words="lang/stopwords_en.txt"
                /&gt;
        &lt;filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/&gt;
        &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
        &lt;filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/&gt;
        &lt;filter class="solr.PorterStemFilterFactory"/&gt;
      &lt;/analyzer&gt;
    &lt;/fieldType&gt;

    &lt;fieldType name="text_en_splitting_tight" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true"&gt;
      &lt;analyzer&gt;
        &lt;tokenizer class="solr.WhitespaceTokenizerFactory"/&gt;
        &lt;filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/&gt;
        &lt;filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_en.txt"/&gt;
        &lt;filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/&gt;
        &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
        &lt;filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/&gt;
        &lt;filter class="solr.EnglishMinimalStemFilterFactory"/&gt;

        &lt;filter class="solr.RemoveDuplicatesTokenFilterFactory"/&gt;
      &lt;/analyzer&gt;
    &lt;/fieldType&gt;

    &lt;fieldType name="text_general_rev" class="solr.TextField" positionIncrementGap="100"&gt;
      &lt;analyzer type="index"&gt;
        &lt;tokenizer class="solr.StandardTokenizerFactory"/&gt;
        &lt;filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" /&gt;
        &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
        &lt;filter class="solr.ReversedWildcardFilterFactory" withOriginal="true"
           maxPosAsterisk="3" maxPosQuestion="2" maxFractionAsterisk="0.33"/&gt;
      &lt;/analyzer&gt;
      &lt;analyzer type="query"&gt;
        &lt;tokenizer class="solr.StandardTokenizerFactory"/&gt;
        &lt;filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/&gt;
        &lt;filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" /&gt;
        &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
      &lt;/analyzer&gt;
    &lt;/fieldType&gt;


    &lt;fieldType name="alphaOnlySort" class="solr.TextField" sortMissingLast="true" omitNorms="true"&gt;
      &lt;analyzer&gt;
        &lt;!-- KeywordTokenizer does no actual tokenizing, so the entire
             input string is preserved as a single token
          --&gt;
        &lt;tokenizer class="solr.KeywordTokenizerFactory"/&gt;
        &lt;!-- The LowerCase TokenFilter does what you expect, which can be
             when you want your sorting to be case insensitive
          --&gt;
        &lt;filter class="solr.LowerCaseFilterFactory" /&gt;
        &lt;!-- The TrimFilter removes any leading or trailing whitespace --&gt;
        &lt;filter class="solr.TrimFilterFactory" /&gt;

        &lt;filter class="solr.PatternReplaceFilterFactory"
                pattern="([^a-z])" replacement="" replace="all"
        /&gt;
      &lt;/analyzer&gt;
    &lt;/fieldType&gt;

    &lt;fieldtype name="phonetic" stored="false" indexed="true" class="solr.TextField" &gt;
      &lt;analyzer&gt;
        &lt;tokenizer class="solr.StandardTokenizerFactory"/&gt;
        &lt;filter class="solr.DoubleMetaphoneFilterFactory" inject="false"/&gt;
      &lt;/analyzer&gt;
    &lt;/fieldtype&gt;

    &lt;fieldtype name="payloads" stored="false" indexed="true" class="solr.TextField" &gt;
      &lt;analyzer&gt;
        &lt;tokenizer class="solr.WhitespaceTokenizerFactory"/&gt;

        &lt;filter class="solr.DelimitedPayloadTokenFilterFactory" encoder="float"/&gt;
      &lt;/analyzer&gt;
    &lt;/fieldtype&gt;

    &lt;!-- lowercases the entire field value, keeping it as a single token.  --&gt;
    &lt;fieldType name="lowercase" class="solr.TextField" positionIncrementGap="100"&gt;
      &lt;analyzer&gt;
        &lt;tokenizer class="solr.KeywordTokenizerFactory"/&gt;
        &lt;filter class="solr.LowerCaseFilterFactory" /&gt;
      &lt;/analyzer&gt;
    &lt;/fieldType&gt;


    &lt;fieldType name="descendent_path" class="solr.TextField"&gt;
      &lt;analyzer type="index"&gt;
    &lt;tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" /&gt;
      &lt;/analyzer&gt;
      &lt;analyzer type="query"&gt;
    &lt;tokenizer class="solr.KeywordTokenizerFactory" /&gt;
      &lt;/analyzer&gt;
    &lt;/fieldType&gt;

    &lt;fieldType name="ancestor_path" class="solr.TextField"&gt;
      &lt;analyzer type="index"&gt;
    &lt;tokenizer class="solr.KeywordTokenizerFactory" /&gt;
      &lt;/analyzer&gt;
      &lt;analyzer type="query"&gt;
    &lt;tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" /&gt;
      &lt;/analyzer&gt;
    &lt;/fieldType&gt;

    &lt;!-- since fields of this type are by default not stored or indexed,
         any data added to them will be ignored outright.  --&gt; 
    &lt;fieldtype name="ignored" stored="false" indexed="false" multiValued="true" class="solr.StrField" /&gt;

    &lt;fieldType name="point" class="solr.PointType" dimension="2" subFieldSuffix="_d"/&gt;

    &lt;!-- A specialized field for geospatial search. If indexed, this fieldType must not be multivalued. --&gt;
    &lt;fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/&gt;

    &lt;fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType"
        geo="true" distErrPct="0.025" maxDistErr="0.000009" units="degrees" /&gt;

    &lt;fieldType name="bbox" class="solr.BBoxField"
        geo="true" units="degrees" numberType="_bbox_coord" /&gt;
    &lt;fieldType name="_bbox_coord" class="solr.TrieDoubleField" precisionStep="8" docValues="true" stored="false"/&gt;


    &lt;fieldType name="currency" class="solr.CurrencyField" precisionStep="8" defaultCurrency="USD" currencyConfig="currency.xml" /&gt;


&lt;/schema&gt;
</code></pre>

<p>And in csv file there following fields : SRNO,IDENTIFIER,AGENTID,AGENTNAME,event_timestamp,MONTH,DAY,TIMESTAMP,TYPE,TASKID
These fields are added in schema.xml file with their data types.</p>

<p>Please do needful to help me out of this problem. Thanks in advance.</p>