15

I've recently upgraded my solr instance from 1,4 to 3.6. However, I now appear to be getting an "undefined field text" severe message in my logs whenever I update my index.

I do have text fields in my schema (which was valid as of version 1.4), but never previously had to be declared as a field type. Has this changed in 3.6?

My schema is here >> http://pastebin.com/KrCVab0U

SEVERE: org.apache.solr.common.SolrException: undefined field text
        at org.apache.solr.schema.IndexSchema.getDynamicFieldType(IndexSchema.java:1330)
        at org.apache.solr.schema.IndexSchema$SolrQueryAnalyzer.getAnalyzer(IndexSchema.java:408)
        at org.apache.solr.schema.IndexSchema$SolrIndexAnalyzer.reusableTokenStream(IndexSchema.java:383)
        at org.apache.lucene.queryParser.QueryParser.getFieldQuery(QueryParser.java:574)
        at org.apache.solr.search.SolrQueryParser.getFieldQuery(SolrQueryParser.java:206)
        at org.apache.lucene.queryParser.QueryParser.Term(QueryParser.java:1429)
        at org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:1317)
        at org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:1245)
        at org.apache.lucene.queryParser.QueryParser.TopLevelQuery(QueryParser.java:1234)
        at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:206)
        at org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:79)
        at org.apache.solr.search.QParser.getQuery(QParser.java:143)
        at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:105)
        at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:165)
        at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
        at org.apache.solr.core.SolrCore.execute(SolrCore.java:1376)
        at org.apache.solr.handler.PingRequestHandler.handleRequestBody(PingRequestHandler.java:67)
        at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
        at org.apache.solr.core.SolrCore.execute(SolrCore.java:1376)
        at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:365)
        at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:260)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:679)
John Snow
  • 5,214
  • 4
  • 37
  • 44
Lee Davis
  • 4,685
  • 3
  • 28
  • 39
  • Actually, it appears the text field type is declared in my schema. Line 220 >> http://pastebin.com/KrCVab0U – Lee Davis Jul 03 '12 at 11:04
  • 1
    Please see if this helps http://stackoverflow.com/questions/10130163/solr-query-http-error-404-undefined-field-text – krishnakumarp Jul 03 '12 at 11:30
  • As far as I see you don't have the field text declared, only the fieldType. The "undefined field type" error seems correct if you are trying to add content to a field called text, which you don't have in your schema. Am I missing something? – javanna Jul 03 '12 at 11:36
  • You can check this answer [answer](https://stackoverflow.com/a/12094791/8148842) for a similar issue. – Vismay Patel Sep 06 '17 at 10:45

5 Answers5

24

It is not about field type "text". It is about field named "text".

You've changed the default field in config to "search_text". Please try renaming all references to "search_text" to "text". If this fixes the issue, then you know somewhere in the configuration you're referring to "text" field, possibly in solrconfig.xml as suggested in Solr Query - HTTP error 404 undefined field text

Hope it helps.

Community
  • 1
  • 1
krishnakumarp
  • 8,967
  • 3
  • 49
  • 55
9

i have this in my solrconfig.xml file.

<requestHandler name="/admin/ping" class="solr.PingRequestHandler">
 <lst name="invariants">
  <str name="q">solrpingquery</str>
 </lst>
 <lst name="defaults">      
  <str name="echoParams">all</str>
  </lst>
</requestHandler>

If you haven't added this in schema.xml then add it

<field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/>

This will solve your problem.

Thanks

Ghulam Rasool
  • 125
  • 1
  • 8
  • 2
    in Solr6, a tiny difference: one need to add the "_ text _ " field to schema.xml (instead of "text"). The "_ text _ " field is used in the default solrconfig – Bob Yoplait Aug 23 '17 at 18:54
3

It just happened too me today. If your doing a query when the error occurs then you need to double quoted the data in the query like this:

filepath:"data to be queried"

Bob
  • 39
  • 1
2

I got the same error when I sanitized the fq part of the query. After sanitizing, the solr received

...&fq=type\:Product&...

Although I have field named type, the error was saying “Undefined field text”.

When I removed the sanitization, the query was ok then:

...&fq=type:Product&...

The cause of the confusing error message was in solrconfig.xml:

<requestHandler name="/select" class="solr.SearchHandler">
  <lst name="defaults">
    <str name="echoParams">explicit</str>
    <int name="rows">10</int>
    <str name="df">text</str>
  </lst>
</requestHandler>
mirelon
  • 4,896
  • 6
  • 40
  • 70
2

in solr admin interface you can see currently working scheme then you can be sure if you are on the right path. below pictrues ilistruates

4.10.2 and higher version(suppose)

solr.4.10.2

lower versions than 4.10.2. you should use left side Scheme menu.

solr.4.10.2

Halis Yılboğa
  • 850
  • 10
  • 12