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.xmldoes 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
examplecore) 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.,titleorcontent). - 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
- Check your schema.xml for
<field name="_text_".../> - Check for
<copyField ... dest="_text_"/>entries - Check queries for
q=...&_df=_text_or similar - 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!

