Undefined field _text_

Errors

The Error

Your query fails with:

org.apache.solr.common.SolrException: Undefined field _text_

This means Solr received a query that references a field called _text_, but that field does not exist in your schema.


What Is _text_?

Think of _text_ as a catch-all bucket. In many Solr setups, _text_ is a special field that collects copies of all your other text fields — title, description, content, tags — into one place. This way, when someone searches without specifying a field, Solr looks in this one bucket and finds matches from everywhere.

It is not a built-in Solr field — it is just a convention. Many Solr example configs include it, and some applications (especially default configs) expect it to exist.

HOW text WORKS AS A CATCH-ALL FIELDtitledescriptioncontentcopyFieldcopyFieldtextcatch-all bucketq=search termsearches everywhereOne query, all fields — because text contains copies of everything.Without it, queries that do not specify a field will fail.


How to Fix It

You have two options: add the field (if you want a catch-all) or stop referencing it (if you do not need it).

Option 1: Add _text_ to Your Schema (Recommended)

Add this field definition to your schema.xml:

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

Then add copyField directives to feed data into it:

<copyField source="title"       dest="_text_"/>
<copyField source="description" dest="_text_"/>
<copyField source="content"     dest="_text_"/>

Now when someone queries q=hello with df=_text_, Solr searches across title, description, and content — all at once.

Option 2: Stop Referencing _text_

If you do not want a catch-all field, remove references to _text_ from your queries and configuration:

  • Check the df (default field) parameter in your request handler defaults in solrconfig.xml
  • Check your application code for queries using _text_
  • Set df to an existing field like title or content
<!-- In solrconfig.xml, change the default field -->
<requestHandler name="/select" class="solr.SearchHandler">
  <lst name="defaults">
    <str name="df">title</str>  <!-- use an existing field -->
  </lst>
</requestHandler>

Complete Example

Here is a minimal schema.xml snippet with _text_ properly set up:

<schema name="example" version="1.6">
  <field name="id"      type="string"       indexed="true" stored="true" required="true"/>
  <field name="title"   type="text_general" indexed="true" stored="true"/>
  <field name="content" type="text_general" indexed="true" stored="true"/>
  <field name="_text_"  type="text_general" indexed="true" stored="false" multiValued="true"/>

  <copyField source="title"   dest="_text_"/>
  <copyField source="content" dest="_text_"/>
</schema>

Quick Reference

Situation What to Do
_text_ not defined in schema Add <field name="_text_" .../>
_text_ defined but empty Add <copyField> directives for your source fields
Query references _text_ but you do not want it Change df parameter to an existing field
Migrated from old Solr version Add _text_ back, or update your query config

Quick Checklist

  • Check your schema.xml for <field name="_text_" .../>
  • Check for <copyField ... dest="_text_"/> entries
  • Check your request handler for df=_text_ in defaults
  • After adding the field, reload your Opensolr Index and re-index your data

Need help setting up a catch-all field? Reach out to us at support@opensolr.com — we can look at your schema and suggest the best approach.