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:
schema.xml
does not declare a <field>
or <dynamicField>
for _text_
.df=_text_
), but does not exist.example
core) elsewhere, but your current core/schema does not have _text_
._text_
._text_
was common in old examples, but new setups may not include it._text_
in Solr?_text_
is a conventional field name, not a built-in Solr field._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.
Example query that fails:
http://localhost:8983/solr/mycore/select?q=solr&df=_text_
Solr error:
org.apache.solr.common.SolrException: Undefined field _text_
_text_
Field in schema.xml
Add to your <fields>
section:
<field name="_text_" type="text_general" indexed="true" stored="false" multiValued="true"/>
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.<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_"/>
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>
_text_
_text_
as default field:http://localhost:8983/solr/mycore/select?q=solr&df=_text_
http://localhost:8983/solr/mycore/select?q=_text_:solr
_text_
:_text_
in your query, config, and client code.df
) to an existing field (e.g., title
or content
).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 |
<field name="_text_".../>
<copyField ... dest="_text_"/>
entriesq=...&_df=_text_
or similarThe “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!