10

While working with Solr, I get this error:

 ERROR:unknown field 'name'

But, I have defined this field in my schema.xml :

<field name="name" type="string" indexed="false" 
       stored="true" required="true" elementForm="INPUTHIDDEN" />

I get this error when I try to add the field to the documment which is going to be commited:

doc.addField("name", getName());
solrClient.addDocument(doc);

Any ideas? Thanks in advance.

John Keyes
  • 5,479
  • 1
  • 29
  • 48
Blanca Hdez
  • 3,513
  • 19
  • 71
  • 93
  • 1
    Will you delete this question just as you deleted the other two questions you posted about Solr? :-/ – Mauricio Scheffer Aug 27 '10 at 20:47
  • I won't, but I don't think nobody will give me an answer :s Sorry for deleting – Blanca Hdez Aug 30 '10 at 11:50
  • I meet the same question today,have you solved this problem? I think I need you help. –  Jul 24 '11 at 13:51
  • 1
    @AndreMouche check your schema.xml. I have Solr running and also another war application. Then I have two schema.xml files. Make sure that you have the field declared in both of them – Blanca Hdez Jul 28 '11 at 10:58
  • 2
    I do have the same problem, using solr 4.3.1. I have defined a filed name 'dateImport' in my schema.xml and set up required="true", I can even see it is the right schema since the field 'dateImport' is present in the schema when browsing the system with the WEBui but when I add this filed to my doc I got "Bad Request". unknown field 'dateImport'. All the other fields work properly but I added this one latter, restarted the system and it fails ! – lizzie Jul 10 '13 at 14:51

2 Answers2

6

If you want to verify your index configuration within Solr, you can use the /admin/luke handler commonly defined in the solrconfig.xml. The output will give you information about the fields that are defined in the schema that Solr has loaded.

If you don't see your name field in there, you should double check that you've updated your schema.xml in the correct location for your index, and that the appropriate Solr core (or Solr itself) has since been restarted to load the changes.

Nick Zadrozny
  • 7,906
  • 33
  • 38
1

i had the same issue, and i found a solution

i did this i got the error unknown field so i looked up in the schema of solr (schema.xml) and i found

i used store that is specified in the schema. you do the same. you should look for a field declared the same way as yours or use commands to add your field ( i don't know very much these, but you gonna find it ;) )