[
https://issues.apache.org/jira/browse/SOLR-6034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13984754#comment-13984754
]
Constantin Muraru commented on SOLR-6034:
-----------------------------------------
Let me provide a better example. Suppose we have documents like this:
<doc>
<field name="id">100</field>
<field name="2_1600_i">1</field>
<field name="5_1601_i">5</field>
<field name="112_1602_i">7</field>
</doc>
The schema looks the usual way:
<dynamicField name="*_i" type="int" indexed="true" stored="true"/>
The dynamic field pattern I'm using is this: id_day_i.
Each day I want to add new fields for the current day and remove the fields for
the oldest one.
<add><doc>
<field name="id">100</field>
<!-- add fields for current day -->
<field name="251_1603_i" update="set">25</field>
<!-- remove fields for oldest day -->
<field name="2_1600_i" update="set" null="true">1</field>
</doc></add>
The problem is, I don't know the exact names of the fields I want to remove.
All I know is that they end in *_1600_i. It is not currently possible to
specify a wildcard when sending an atomic update to SOLR.
When removing fields from a document, I want to avoid querying SOLR from the
client, in order to see what fields are actually present for the specific
document. In this way, hopefully I can speed up the process. Querying to see
the schema.xml is not going to help me much, since the field is defined a
dynamic field *_i. This makes me think that expanding the documents client-side
is not the best way to do it.
> Use a wildcard in order to delete fields with Atomic Update
> -----------------------------------------------------------
>
> Key: SOLR-6034
> URL: https://issues.apache.org/jira/browse/SOLR-6034
> Project: Solr
> Issue Type: Improvement
> Components: contrib - DataImportHandler
> Affects Versions: 4.7
> Reporter: Constantin Muraru
>
> As discussed on the SOLR user group, it would a great feature to be able to
> remove all fields matching a pattern, using Atomic Updates.
> Example:
> <add><doc>
> <field name="id">100</field>
> <field name="*_day_i" update="set" null="true"></field>
> </doc></add>
> The *_day_i should be expanded server-side and all fields matching this
> pattern should be removed from the specified document.
> Workaround: When removing fields from a document, we can make a query to SOLR
> from the client, in order to see what fields are actually present for the
> specific document. After that, we can create the XML update document to be
> sent to SOLR. However, this is going to increase the number of queries to
> SOLR and for large amount of documents this is going to weigh pretty much. It
> would be great performance-wise and simplicity-wise to be able to provide
> wildcards.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]