You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by kumar gaurav <kg...@gmail.com> on 2017/12/12 13:23:26 UTC

Prevent Document to get partially indexed if document is not available

Hi

I need to update documents partially to solr only if it is already present
there . But the problem is it creates a new document if document not
available .

Please help someone .

Thanks

regards
Kumar Gaurav

Re: Prevent Document to get partially indexed if document is not available

Posted by kumar gaurav <kg...@gmail.com>.
Yes . It is working for me .

Thanks Emir & Mikhali  :)

Just a last question . Will it hurt any other document index while indexing
partially with _version_ field or any other fallback if i am regularly
sending _version_:1 for each partial document update .

Example -

{"product_id":"12345","product":{set:"nokia"},"_version_":1}

product_id is unique key . I don't think it will hamper any other document
. Yet please confirm ,

Appreciate your support .


On Wed, Dec 13, 2017 at 3:11 PM, Emir Arnautović <
emir.arnautovic@sematext.com> wrote:

> Hi,
> Did you try with _version_=1
>
> “If the content in the _version_ field is equal to '1', then the document
> must simply exist. In this case, no version matching occurs, but if the
> document does not exist, the updates will be rejected.”
>
> Regards,
> Emir
> --
> Monitoring - Log Management - Alerting - Anomaly Detection
> Solr & Elasticsearch Consulting Support Training - http://sematext.com/
>
>
>
> > On 13 Dec 2017, at 09:24, kumar gaurav <kg...@gmail.com> wrote:
> >
> > Hi Mikhali
> >
> > Thanks for this knowledge .
> >
> > But i want to prevent partial update in case of document not exists . I
> do
> > not want to call rest solr api to check existence of document before
> > updating document partially  .
> >
> > Is there not any configuration in solr to prevent creating new document
> in
> > case of partial update ?
> >
> >
> >
> >
> > On Tue, Dec 12, 2017 at 9:29 PM, Mikhail Khludnev <mk...@apache.org>
> wrote:
> >
> >> https://lucene.apache.org/solr/guide/6_6/updating-parts-
> of-documents.html#
> >> UpdatingPartsofDocuments-OptimisticConcurrency
> >> If the content in the _version_ field is less than '0' (i.e., '-1'),
> then
> >> the document must *not* exist. In this case, no version matching occurs,
> >> but if the document exists, the updates will be rejected.
> >>
> >> On Tue, Dec 12, 2017 at 4:23 PM, kumar gaurav <kg...@gmail.com> wrote:
> >>
> >>> Hi
> >>>
> >>> I need to update documents partially to solr only if it is already
> >> present
> >>> there . But the problem is it creates a new document if document not
> >>> available .
> >>>
> >>> Please help someone .
> >>>
> >>> Thanks
> >>>
> >>> regards
> >>> Kumar Gaurav
> >>>
> >>
> >>
> >>
> >> --
> >> Sincerely yours
> >> Mikhail Khludnev
> >>
>
>

Re: Prevent Document to get partially indexed if document is not available

Posted by Emir Arnautović <em...@sematext.com>.
Hi,
Did you try with _version_=1

“If the content in the _version_ field is equal to '1', then the document must simply exist. In this case, no version matching occurs, but if the document does not exist, the updates will be rejected.”

Regards,
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/



> On 13 Dec 2017, at 09:24, kumar gaurav <kg...@gmail.com> wrote:
> 
> Hi Mikhali
> 
> Thanks for this knowledge .
> 
> But i want to prevent partial update in case of document not exists . I do
> not want to call rest solr api to check existence of document before
> updating document partially  .
> 
> Is there not any configuration in solr to prevent creating new document in
> case of partial update ?
> 
> 
> 
> 
> On Tue, Dec 12, 2017 at 9:29 PM, Mikhail Khludnev <mk...@apache.org> wrote:
> 
>> https://lucene.apache.org/solr/guide/6_6/updating-parts-of-documents.html#
>> UpdatingPartsofDocuments-OptimisticConcurrency
>> If the content in the _version_ field is less than '0' (i.e., '-1'), then
>> the document must *not* exist. In this case, no version matching occurs,
>> but if the document exists, the updates will be rejected.
>> 
>> On Tue, Dec 12, 2017 at 4:23 PM, kumar gaurav <kg...@gmail.com> wrote:
>> 
>>> Hi
>>> 
>>> I need to update documents partially to solr only if it is already
>> present
>>> there . But the problem is it creates a new document if document not
>>> available .
>>> 
>>> Please help someone .
>>> 
>>> Thanks
>>> 
>>> regards
>>> Kumar Gaurav
>>> 
>> 
>> 
>> 
>> --
>> Sincerely yours
>> Mikhail Khludnev
>> 


Re: Prevent Document to get partially indexed if document is not available

Posted by kumar gaurav <kg...@gmail.com>.
Hi Mikhali

Thanks for this knowledge .

But i want to prevent partial update in case of document not exists . I do
not want to call rest solr api to check existence of document before
updating document partially  .

Is there not any configuration in solr to prevent creating new document in
case of partial update ?




On Tue, Dec 12, 2017 at 9:29 PM, Mikhail Khludnev <mk...@apache.org> wrote:

> https://lucene.apache.org/solr/guide/6_6/updating-parts-of-documents.html#
> UpdatingPartsofDocuments-OptimisticConcurrency
> If the content in the _version_ field is less than '0' (i.e., '-1'), then
> the document must *not* exist. In this case, no version matching occurs,
> but if the document exists, the updates will be rejected.
>
> On Tue, Dec 12, 2017 at 4:23 PM, kumar gaurav <kg...@gmail.com> wrote:
>
> > Hi
> >
> > I need to update documents partially to solr only if it is already
> present
> > there . But the problem is it creates a new document if document not
> > available .
> >
> > Please help someone .
> >
> > Thanks
> >
> > regards
> > Kumar Gaurav
> >
>
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>

Re: Prevent Document to get partially indexed if document is not available

Posted by Mikhail Khludnev <mk...@apache.org>.
https://lucene.apache.org/solr/guide/6_6/updating-parts-of-documents.html#UpdatingPartsofDocuments-OptimisticConcurrency
If the content in the _version_ field is less than '0' (i.e., '-1'), then
the document must *not* exist. In this case, no version matching occurs,
but if the document exists, the updates will be rejected.

On Tue, Dec 12, 2017 at 4:23 PM, kumar gaurav <kg...@gmail.com> wrote:

> Hi
>
> I need to update documents partially to solr only if it is already present
> there . But the problem is it creates a new document if document not
> available .
>
> Please help someone .
>
> Thanks
>
> regards
> Kumar Gaurav
>



-- 
Sincerely yours
Mikhail Khludnev