Documentation > Errors in Solr > Undefined field _text_

Understanding the “Undefined field text” Error in Apache Solr

What Causes the “Undefined field text” Error?

The error message:

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

means that Solr received a query, filter, or request that references a field named _text_, but this field is not defined in your Solr schema.

This typically happens when:

  • Your schema.xml does not declare a <field> or <dynamicField> for _text_.
  • The field is expected by your queries or by a default configuration (e.g., df=_text_), but does not exist.
  • You are using Solr default configs (like in the example core) elsewhere, but your current core/schema does not have _text_.
  • A copyField configuration is missing or misconfigured, so nothing is populating _text_.
  • Upgrading from Solr 4.x/5.x to 6.x+ (or SolrCloud): _text_ was common in old examples, but new setups may not include it.

What Is _text_ in Solr?

  • _text_ is a conventional field name, not a built-in Solr field.
  • In many Solr demos, _text_ is a catch-all field that copies the content of multiple other fields (using <copyField>), to make full-text searching easier.

If your schema doesn’t define _text_, and a query refers to it, you’ll get this error.

Typical Scenario: Missing text Field

Example query that fails:

http://localhost:8983/solr/mycore/select?q=solr&df=_text_

Solr error:

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

Solutions and Examples

1. Define the _text_ Field in schema.xml

Add to your <fields> section:

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

Explanation:

  • type="text_general" uses Solr’s default full-text analysis (use your appropriate type).
  • multiValued="true" allows multiple fields to be copied into _text_.
  • stored="false" saves space if you only need it for searching.

2. Use <copyField> to Populate _text_

Add to your schema.xml:

<!-- Example: copy title, description, and content into _text_ -->
<copyField source="title"        dest="_text_"/>
<copyField source="description"  dest="_text_"/>
<copyField source="content"      dest="_text_"/>

3. Example schema.xml Snippet

<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>

4. Query Examples Using _text_

Query with _text_ as default field:

http://localhost:8983/solr/mycore/select?q=solr&df=_text_

Explicit field query:

http://localhost:8983/solr/mycore/select?q=_text_:solr

5. If You Don’t Want _text_:

  • Remove references to _text_ in your query, config, and client code.
  • Set the default search field (df) to an existing field (e.g., title or content).
  • Or, define and use a new catch-all field with a different name.

Summary Table

Cause Solution
_text_ not defined Add <field> for _text_ in schema.xml
_text_ not populated Add <copyField> for sources to _text_
Query refers to _text_ Update query to use an existing field, or define _text_
Migrated core/config Add _text_ back, or adjust queries/configs to not use it

Classic Troubleshooting Steps

  1. Check your schema.xml for <field name="_text_".../>
  2. Check for <copyField ... dest="_text_"/> entries
  3. Check queries for q=...&_df=_text_ or similar
  4. Check your Solr logs for stack traces and field definitions

Conclusion

The “Undefined field text” error means you’re referencing a field that isn’t defined or populated.
Restore _text_ with <field> and <copyField>, or update your queries/configs to not depend on it.


May your schemas be valid and your queries swift!






Review us on Google Business
ISO-9001 CERTIFIED ISO-27001 CERTIFIED