You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by "Natarajan, Rajeswari" <ra...@sap.com.INVALID> on 2022/12/22 06:37:58 UTC

Reg. Field Level Update (Atomic update) (Solr 8.11.1) behavior

Hi All,

We have solr 8.11.1 . we would like to update a field which is defined as stored=false  and indexed=true in schema.  According to the documentation ,
https://solr.apache.org/guide/8_11/updating-parts-of-documents.html  , the field has to be defined as stored=true  Below is the snippet from the page

The core functionality of atomically updating a document requires that all fields in your schema must be configured as stored (stored="true") or docValues (docValues="true") except for fields which are <copyField/> destinations, which must be configured as stored="false". Atomic updates are applied to the document represented by the existing stored field values. All data in copyField destinations fields must originate from ONLY copyField sources.

Did an experiment with sample_techproducts_config by changing the name field as below with stored=false.

<field name="name" type="text_general" indexed="true" stored="false"/>



Created a collection with configset sample_techproducts_config



Published this payload



{

    "id" : "978-1423103349",

    "cat" : ["book","paperback"],

    "name" : "The Sea of Monsters",

    "author" : "Rick Riordan",

    "series_t" : "Percy Jackson and the Olympians",

    "sequence_i" : 2,

    "genre_s" : "fantasy",

    "inStock" : true,

    "price" : 6.49,

    "pages_i" : 304

  }





And couldn’t see the name field in the query. Did field update as below
{"id":"978-1423103349",
 "name":{"set": "this is completely new name RN"}
}

Hoping this will fail ,but it succeeded .


Also could search

http://localhost:8983/solr/testme/select?indent=true&q=name:”rn”

search result
{
  "responseHeader":{
    "zkConnected":true,
    "status":0,
    "QTime":0,
    "params":{
      "q":"name:\"rn\"",
      "indent":"true"}},
  "response":{"numFound":1,"start":0,"numFoundExact":true,"docs":[
      {
        "id":"978-1423103349",
        "cat":["book",
          "paperback"],
        "author":"Rick Riordan",
        "author_s":"Rick Riordan",
        "series_t":"Percy Jackson and the Olympians",
        "sequence_i":2,
        "genre_s":"fantasy",
        "inStock":true,
        "price":6.49,
        "price_c":"6.49,USD",
        "pages_i":304,
        "_version_":1752890818039906304,
        "price_c____l_ns":649}]
  }}


Question :
Looks like the documentation needs to be updated ? (as stored=true is not mandatory to do Atomic field update and this field is not copy field) or am I missing something . Please let me know.


Thanks,
Rajeswari



Re: Reg. Field Level Update (Atomic update) (Solr 8.11.1) behavior

Posted by Shawn Heisey <ap...@elyograg.org>.
On 12/22/22 10:04, Natarajan, Rajeswari wrote:
> Thanks for the response .On further testing , I found it doesn't work well. I expected the field level update to fail while publishing ,but it succeeds and the searches behave differently

If the schema doesn't meet those requirements for Atomic Update, the 
request isn't going to fail, it's just not going to produce the expected 
results.

Any field data in the document where the field is not stored (or 
docValues="true" and useDocValuesAsStored="true") and not fully 
specified in the update will be lost.

Thanks,
Shawn

Re: Reg. Field Level Update (Atomic update) (Solr 8.11.1) behavior

Posted by "Natarajan, Rajeswari" <ra...@sap.com.INVALID>.
Thanks for the response .On further testing , I found it doesn't work well. I expected the field level update to fail while publishing ,but it succeeds and the searches behave differently

Regards,
Rajeswari

On 12/21/22, 11:43 PM, "Thomas Corthals" <th...@klascement.net> wrote:

    Hi Rajeswari,

    I think you're just "lucking out" because you're setting that field
    specifically. There is no need to get the stored content from the index as
    you're providing the content in your update query.

    Try atomically updating another field and see if you can still find this
    document by querying the name field. You shouldn't be able to. E.g.:

    {"id":"978-1423103349",
     "inStock":{"set": false}
    }


    Thomas


    Op do 22 dec. 2022 om 07:37 schreef Natarajan, Rajeswari
    <ra...@sap.com.invalid>:

    > Hi All,
    >
    > We have solr 8.11.1 . we would like to update a field which is defined as
    > stored=false  and indexed=true in schema.  According to the documentation ,
    > https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsolr.apache.org%2Fguide%2F8_11%2Fupdating-parts-of-documents.html&data=05%7C01%7Crajeswari.natarajan%40sap.com%7C0ccf7640c4c04ed31d1c08dae3f03031%7C42f7676cf455423c82f6dc2d99791af7%7C0%7C0%7C638072918010090592%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=IkX106UW7cc4svmE4ZoD%2B%2FajPbMajMtOBhXCm81432I%3D&reserved=0  ,
    > the field has to be defined as stored=true  Below is the snippet from the
    > page
    >
    > The core functionality of atomically updating a document requires that all
    > fields in your schema must be configured as stored (stored="true") or
    > docValues (docValues="true") except for fields which are <copyField/>
    > destinations, which must be configured as stored="false". Atomic updates
    > are applied to the document represented by the existing stored field
    > values. All data in copyField destinations fields must originate from ONLY
    > copyField sources.
    >
    > Did an experiment with sample_techproducts_config by changing the name
    > field as below with stored=false.
    >
    > <field name="name" type="text_general" indexed="true" stored="false"/>
    >
    >
    >
    > Created a collection with configset sample_techproducts_config
    >
    >
    >
    > Published this payload
    >
    >
    >
    > {
    >
    >     "id" : "978-1423103349",
    >
    >     "cat" : ["book","paperback"],
    >
    >     "name" : "The Sea of Monsters",
    >
    >     "author" : "Rick Riordan",
    >
    >     "series_t" : "Percy Jackson and the Olympians",
    >
    >     "sequence_i" : 2,
    >
    >     "genre_s" : "fantasy",
    >
    >     "inStock" : true,
    >
    >     "price" : 6.49,
    >
    >     "pages_i" : 304
    >
    >   }
    >
    >
    >
    >
    >
    > And couldn’t see the name field in the query. Did field update as below
    > {"id":"978-1423103349",
    >  "name":{"set": "this is completely new name RN"}
    > }
    >
    > Hoping this will fail ,but it succeeded .
    >
    >
    > Also could search
    >
    > http://localhost:8983/solr/testme/select?indent=true&q=name:”rn”
    >
    > search result
    > {
    >   "responseHeader":{
    >     "zkConnected":true,
    >     "status":0,
    >     "QTime":0,
    >     "params":{
    >       "q":"name:\"rn\"",
    >       "indent":"true"}},
    >   "response":{"numFound":1,"start":0,"numFoundExact":true,"docs":[
    >       {
    >         "id":"978-1423103349",
    >         "cat":["book",
    >           "paperback"],
    >         "author":"Rick Riordan",
    >         "author_s":"Rick Riordan",
    >         "series_t":"Percy Jackson and the Olympians",
    >         "sequence_i":2,
    >         "genre_s":"fantasy",
    >         "inStock":true,
    >         "price":6.49,
    >         "price_c":"6.49,USD",
    >         "pages_i":304,
    >         "_version_":1752890818039906304,
    >         "price_c____l_ns":649}]
    >   }}
    >
    >
    > Question :
    > Looks like the documentation needs to be updated ? (as stored=true is not
    > mandatory to do Atomic field update and this field is not copy field) or am
    > I missing something . Please let me know.
    >
    >
    > Thanks,
    > Rajeswari
    >
    >
    >


Re: Reg. Field Level Update (Atomic update) (Solr 8.11.1) behavior

Posted by Thomas Corthals <th...@klascement.net>.
Hi Rajeswari,

I think you're just "lucking out" because you're setting that field
specifically. There is no need to get the stored content from the index as
you're providing the content in your update query.

Try atomically updating another field and see if you can still find this
document by querying the name field. You shouldn't be able to. E.g.:

{"id":"978-1423103349",
 "inStock":{"set": false}
}


Thomas


Op do 22 dec. 2022 om 07:37 schreef Natarajan, Rajeswari
<ra...@sap.com.invalid>:

> Hi All,
>
> We have solr 8.11.1 . we would like to update a field which is defined as
> stored=false  and indexed=true in schema.  According to the documentation ,
> https://solr.apache.org/guide/8_11/updating-parts-of-documents.html  ,
> the field has to be defined as stored=true  Below is the snippet from the
> page
>
> The core functionality of atomically updating a document requires that all
> fields in your schema must be configured as stored (stored="true") or
> docValues (docValues="true") except for fields which are <copyField/>
> destinations, which must be configured as stored="false". Atomic updates
> are applied to the document represented by the existing stored field
> values. All data in copyField destinations fields must originate from ONLY
> copyField sources.
>
> Did an experiment with sample_techproducts_config by changing the name
> field as below with stored=false.
>
> <field name="name" type="text_general" indexed="true" stored="false"/>
>
>
>
> Created a collection with configset sample_techproducts_config
>
>
>
> Published this payload
>
>
>
> {
>
>     "id" : "978-1423103349",
>
>     "cat" : ["book","paperback"],
>
>     "name" : "The Sea of Monsters",
>
>     "author" : "Rick Riordan",
>
>     "series_t" : "Percy Jackson and the Olympians",
>
>     "sequence_i" : 2,
>
>     "genre_s" : "fantasy",
>
>     "inStock" : true,
>
>     "price" : 6.49,
>
>     "pages_i" : 304
>
>   }
>
>
>
>
>
> And couldn’t see the name field in the query. Did field update as below
> {"id":"978-1423103349",
>  "name":{"set": "this is completely new name RN"}
> }
>
> Hoping this will fail ,but it succeeded .
>
>
> Also could search
>
> http://localhost:8983/solr/testme/select?indent=true&q=name:”rn”
>
> search result
> {
>   "responseHeader":{
>     "zkConnected":true,
>     "status":0,
>     "QTime":0,
>     "params":{
>       "q":"name:\"rn\"",
>       "indent":"true"}},
>   "response":{"numFound":1,"start":0,"numFoundExact":true,"docs":[
>       {
>         "id":"978-1423103349",
>         "cat":["book",
>           "paperback"],
>         "author":"Rick Riordan",
>         "author_s":"Rick Riordan",
>         "series_t":"Percy Jackson and the Olympians",
>         "sequence_i":2,
>         "genre_s":"fantasy",
>         "inStock":true,
>         "price":6.49,
>         "price_c":"6.49,USD",
>         "pages_i":304,
>         "_version_":1752890818039906304,
>         "price_c____l_ns":649}]
>   }}
>
>
> Question :
> Looks like the documentation needs to be updated ? (as stored=true is not
> mandatory to do Atomic field update and this field is not copy field) or am
> I missing something . Please let me know.
>
>
> Thanks,
> Rajeswari
>
>
>