Rename field in all documents from `i_itemNumber_l` to `i_itemNumber_cp_l`

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Rename field in all documents from `i_itemNumber_l` to `i_itemNumber_cp_l`

Sebastian Riemer

Dear mailing list,

 

I would like to know:

 

Is there some simple way to rename a field in all documents in my solr index?

 

I am using a dynamic schema definition, and I’ve introduced some new copyField-instructions. Those make it necessary to reindex all documents. It would help me a great deal to be able to rename a specific field from:

 

`i_itemNumber_l` to `i_itemNumber_cp_l`

 

I don’t really mind to reindex all documents too, but that takes some time and having my (old) documents return NULL as value for the field `i_itemNumber_cp_l` is breaking a lot of stuff.

 

So if there _IS_ a way to rename that field, that would help tremendously. Btw. I am using Solr 6.5.1 and I use SolrJ in my ApplicationLayer.

 

Best regards and as always,

 

Thank you so much for any input!

 

 

Yours,

Sebastian

 

Mit freundlichen Grüßen

Sebastian Riemer, BSc

 

 


LITTERA Software & Consulting GmbH

A-6060 Hall i.T., Haller Au 19a

Telefon: +43(0) 50 765 000, Fax: +43(0) 50 765 118

Sitz: Hall i.T., eingetragen beim Handelsgericht Innsbruck,
Firmenbuch-Nr. FN 295807k, geschäftsführender Gesellschafter: Albert Unterkircher

 

D-80637 München, Landshuter Allee 8-10
Telefon: +49(0) 89 919 29 122, Fax: +49(0) 89 919 29 123

Sitz: München, eingetragen beim Amtsgericht München
unter HRB 103698, Geschäftsführer: Albert Unterkircher

E-Mail: <a href="blocked::mailto:office@littera.eu" title="blocked::mailto:office@littera.eu">office@...
Homepage
: www.littera.eu

 

Diese Nachricht kann vertrauliche, nicht für die Veröffentlichung bestimmte und/oder rechtlich geschützte Informationen enthalten. Falls Sie nicht der beabsichtigte Empfänger sind, beachten Sie bitte, dass jegliche Veröffentlichung, Verbreitung oder Vervielfältigung dieser Nachricht strengstens untersagt ist. Sollten Sie diese Nachricht irrtümlich erhalten haben, informieren Sie bitte sofort den Absender durch Anruf oder Rücksendung der Nachricht und vernichten Sie diese.

This communication may contain information that is legally privileged, confidential or exempt from disclosure.  If you are not the intended recipient, please note that any dissemination, distribution, or copying of this communication is strictly prohibited.  Anyone who receives this message in error should notify the sender immediately by telephone or by return e-mail and delete this communication entirely from his or her computer.

 

Reply | Threaded
Open this post in threaded view
|

Re: Rename field in all documents from `i_itemNumber_l` to `i_itemNumber_cp_l`

Alexandre Rafalovitch
I don't think you can rename it in the index.

However, you may be able to rename it during the query:
https://lucene.apache.org/solr/guide/6_6/common-query-parameters.html#CommonQueryParameters-FieldNameAliases

Or, if you use eDisMax, during query rewriting:
https://lucene.apache.org/solr/guide/6_6/the-extended-dismax-query-parser.html
, see example at:
https://github.com/arafalov/solr-indexing-book/blob/master/published/languages/conf/solrconfig.xml#L20-L21

These two may need to play together actually, if you want it to be fully
transparent to the client code. See the #37 of the example above.

Regards,
   Alex.


On Mon, 16 Sep 2019 at 03:54, Sebastian Riemer <[hidden email]> wrote:

> Dear mailing list,
>
>
>
> I would like to know:
>
>
>
> Is there some simple way to rename a field in all documents in my solr
> index?
>
>
>
> I am using a dynamic schema definition, and I’ve introduced some new
> copyField-instructions. Those make it necessary to reindex all documents.
> It would help me a great deal to be able to rename a specific field from:
>
>
>
> `i_itemNumber_l` to `i_itemNumber_cp_l`
>
>
>
> I don’t really mind to reindex all documents too, but that takes some time
> and having my (old) documents return NULL as value for the field
> `i_itemNumber_cp_l` is breaking a lot of stuff.
>
>
>
> So if there _*IS*_ a way to rename that field, that would help
> tremendously. Btw. I am using Solr 6.5.1 and I use SolrJ in my
> ApplicationLayer.
>
>
>
> Best regards and as always,
>
>
>
> Thank you so much for any input!
>
>
>
>
>
> Yours,
>
> Sebastian
>
>
>
> Mit freundlichen Grüßen
>
> Sebastian Riemer, BSc
>
>
>
>
>
> [image: logo_Littera_SC] <http://www.littera.eu/>
> LITTERA Software & Consulting GmbH
>
> A-6060 Hall i.T., Haller Au 19a
>
> Telefon: +43(0) 50 765 000, Fax: +43(0) 50 765 118
>
> Sitz: Hall i.T., eingetragen beim Handelsgericht Innsbruck,
> Firmenbuch-Nr. FN 295807k, geschäftsführender Gesellschafter: Albert
> Unterkircher
>
>
>
> D-80637 München, Landshuter Allee 8-10
> Telefon: +49(0) 89 919 29 122, Fax: +49(0) 89 919 29 123
>
> Sitz: München, eingetragen beim Amtsgericht München
> unter HRB 103698, Geschäftsführer: Albert Unterkircher
>
> E-Mail: [hidden email]
> Homepage: www.littera.eu
>
>
>
> Diese Nachricht kann vertrauliche, nicht für die Veröffentlichung
> bestimmte und/oder rechtlich geschützte Informationen enthalten. Falls Sie
> nicht der beabsichtigte Empfänger sind, beachten Sie bitte, dass jegliche
> Veröffentlichung, Verbreitung oder Vervielfältigung dieser Nachricht
> strengstens untersagt ist. Sollten Sie diese Nachricht irrtümlich erhalten
> haben, informieren Sie bitte sofort den Absender durch Anruf oder
> Rücksendung der Nachricht und vernichten Sie diese.
>
> This communication may contain information that is legally privileged,
> confidential or exempt from disclosure.  If you are not the intended
> recipient, please note that any dissemination, distribution, or copying of
> this communication is strictly prohibited.  Anyone who receives this
> message in error should notify the sender immediately by telephone or by
> return e-mail and delete this communication entirely from his or her
> computer.
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Rename field in all documents from `i_itemNumber_l` to `i_itemNumber_cp_l`

Erick Erickson
If you’re reindexing anyway, I recommend you index to a new collection then use “collection aliasing” to point to the new one, that’s cleanest.

There’s no way to rename fields. Further, the meta-data will be carried in the index forever even if all docs have been reindexed into an existing collection. It’s a long story. For just a few fields this is totally transparent and not a problem, just FYI.

And from there, Alexandre’s comments will allow you to keep the application the same.

Best,
Erick

> On Sep 16, 2019, at 9:56 AM, Alexandre Rafalovitch <[hidden email]> wrote:
>
> I don't think you can rename it in the index.
>
> However, you may be able to rename it during the query:
> https://lucene.apache.org/solr/guide/6_6/common-query-parameters.html#CommonQueryParameters-FieldNameAliases
>
> Or, if you use eDisMax, during query rewriting:
> https://lucene.apache.org/solr/guide/6_6/the-extended-dismax-query-parser.html
> , see example at:
> https://github.com/arafalov/solr-indexing-book/blob/master/published/languages/conf/solrconfig.xml#L20-L21
>
> These two may need to play together actually, if you want it to be fully
> transparent to the client code. See the #37 of the example above.
>
> Regards,
>   Alex.
>
>
> On Mon, 16 Sep 2019 at 03:54, Sebastian Riemer <[hidden email]> wrote:
>
>> Dear mailing list,
>>
>>
>>
>> I would like to know:
>>
>>
>>
>> Is there some simple way to rename a field in all documents in my solr
>> index?
>>
>>
>>
>> I am using a dynamic schema definition, and I’ve introduced some new
>> copyField-instructions. Those make it necessary to reindex all documents.
>> It would help me a great deal to be able to rename a specific field from:
>>
>>
>>
>> `i_itemNumber_l` to `i_itemNumber_cp_l`
>>
>>
>>
>> I don’t really mind to reindex all documents too, but that takes some time
>> and having my (old) documents return NULL as value for the field
>> `i_itemNumber_cp_l` is breaking a lot of stuff.
>>
>>
>>
>> So if there _*IS*_ a way to rename that field, that would help
>> tremendously. Btw. I am using Solr 6.5.1 and I use SolrJ in my
>> ApplicationLayer.
>>
>>
>>
>> Best regards and as always,
>>
>>
>>
>> Thank you so much for any input!
>>
>>
>>
>>
>>
>> Yours,
>>
>> Sebastian
>>
>>
>>
>> Mit freundlichen Grüßen
>>
>> Sebastian Riemer, BSc
>>
>>
>>
>>
>>
>> [image: logo_Littera_SC] <http://www.littera.eu/>
>> LITTERA Software & Consulting GmbH
>>
>> A-6060 Hall i.T., Haller Au 19a
>>
>> Telefon: +43(0) 50 765 000, Fax: +43(0) 50 765 118
>>
>> Sitz: Hall i.T., eingetragen beim Handelsgericht Innsbruck,
>> Firmenbuch-Nr. FN 295807k, geschäftsführender Gesellschafter: Albert
>> Unterkircher
>>
>>
>>
>> D-80637 München, Landshuter Allee 8-10
>> Telefon: +49(0) 89 919 29 122, Fax: +49(0) 89 919 29 123
>>
>> Sitz: München, eingetragen beim Amtsgericht München
>> unter HRB 103698, Geschäftsführer: Albert Unterkircher
>>
>> E-Mail: [hidden email]
>> Homepage: www.littera.eu
>>
>>
>>
>> Diese Nachricht kann vertrauliche, nicht für die Veröffentlichung
>> bestimmte und/oder rechtlich geschützte Informationen enthalten. Falls Sie
>> nicht der beabsichtigte Empfänger sind, beachten Sie bitte, dass jegliche
>> Veröffentlichung, Verbreitung oder Vervielfältigung dieser Nachricht
>> strengstens untersagt ist. Sollten Sie diese Nachricht irrtümlich erhalten
>> haben, informieren Sie bitte sofort den Absender durch Anruf oder
>> Rücksendung der Nachricht und vernichten Sie diese.
>>
>> This communication may contain information that is legally privileged,
>> confidential or exempt from disclosure.  If you are not the intended
>> recipient, please note that any dissemination, distribution, or copying of
>> this communication is strictly prohibited.  Anyone who receives this
>> message in error should notify the sender immediately by telephone or by
>> return e-mail and delete this communication entirely from his or her
>> computer.