Warm tip: This article is reproduced from serverfault.com, please click

Solr indexing some of fields in a Tuple

发布于 2020-12-05 03:55:53

I am new to Solr. I have a question regarding Solr indexing. Currently we have below configuration to index all the fields in a Tuple.

<!--contact fields -->
<field indexed="true" multiValued="false" name="contact" stored="false" type="TupleField"/>
<field docValues="true" indexed="true" multiValued="false" name="contact.first_name" stored="false" type="TextField"/>
<field docValues="true" indexed="true" multiValued="false" name="contact.last_name" stored="false" type="TextField"/>
<field docValues="true" indexed="true" multiValued="false" name="contact.email" stored="false" type="TextField"/>

I am trying to avoid indexing unwanted fields. In the above config i wanted to remove the indexing for first_name and last_name. Basically i want to have index on email field only.

Do i need to remove the fields (first_name and last_name) in the above config and mention

<field indexed="true" multiValued="false" name="contact" stored="false" type="TupleField"/>
<field docValues="true" indexed="true" multiValued="false" name="contact.email" stored="false" type="TextField"/>

or I need to mention all the fields and make docValues and indexed as false? I guess both are same. But can some one confirm above change is good?

Questioner
Kiran
Viewed
0
MatsLindh 2020-12-06 04:32:22

In production usage you should always mention all fields, so that you don't suddenly get weird behavior from fields being added by the schemaless mode.

Keep the configuration and set indexed and docValues explicitly to false if you don't need them.