lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ishan Chattopadhyaya (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SOLR-11265) Add support for atomic updates to /update and /update/json for V2
Date Mon, 21 Aug 2017 08:35:00 GMT

     [ https://issues.apache.org/jira/browse/SOLR-11265?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Ishan Chattopadhyaya updated SOLR-11265:
----------------------------------------
    Description: 
In V2 APIs, set, inc, etc. operations do not work with /update or /update/json. They work
only with /update/json/commands.

Steps to reproduce:
{code}
$ curl http://localhost:8983/api/collections/demo/update -d '
[
 {"id" : "book1",
  "title_t" : "Snow Crash",    // text field
  "copies_i" : 5,
  "cat_ss" : "Science Fiction" // multi-valued string field
 }
]'

$ curl http://localhost:8983/api/collections/demo/update -d '
[
 {"id"         : "book1",
  "author_s"   : {"set":"Neal Stephenson"},
  "copies_i"   : {"inc":3},
  "cat_ss"     : {"add":"Cyberpunk"}
 }
]'
{code}

This results in the following document:
{code}
{
        "id":"book1",
        "author_s.set":["Neal Stephenson"],
        "copies_i.inc":[3],
        "cat_ss.add":["Cyberpunk"],
        "_version_":1576306836595802112,
        "cat_ss.add_str":["Cyberpunk"],
        "author_s.set_str":["Neal Stephenson"]}]
  }
{code}

Example from Yonik's blog: http://yonik.com/solr/atomic-updates/

  was:
The maps used for set, inc, etc. operations are confusing the V2 handler.

Steps to reproduce:
{code}
$ curl http://localhost:8983/api/collections/demo/update -d '
[
 {"id" : "book1",
  "title_t" : "Snow Crash",    // text field
  "copies_i" : 5,
  "cat_ss" : "Science Fiction" // multi-valued string field
 }
]'

$ curl http://localhost:8983/api/collections/demo/update -d '
[
 {"id"         : "book1",
  "author_s"   : {"set":"Neal Stephenson"},
  "copies_i"   : {"inc":3},
  "cat_ss"     : {"add":"Cyberpunk"}
 }
]'
{code}

This results in the following document:
{code}
{
        "id":"book1",
        "author_s.set":["Neal Stephenson"],
        "copies_i.inc":[3],
        "cat_ss.add":["Cyberpunk"],
        "_version_":1576306836595802112,
        "cat_ss.add_str":["Cyberpunk"],
        "author_s.set_str":["Neal Stephenson"]}]
  }
{code}

Example from Yonik's blog: http://yonik.com/solr/atomic-updates/


> Add support for atomic updates to /update and /update/json for V2
> -----------------------------------------------------------------
>
>                 Key: SOLR-11265
>                 URL: https://issues.apache.org/jira/browse/SOLR-11265
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Ishan Chattopadhyaya
>
> In V2 APIs, set, inc, etc. operations do not work with /update or /update/json. They
work only with /update/json/commands.
> Steps to reproduce:
> {code}
> $ curl http://localhost:8983/api/collections/demo/update -d '
> [
>  {"id" : "book1",
>   "title_t" : "Snow Crash",    // text field
>   "copies_i" : 5,
>   "cat_ss" : "Science Fiction" // multi-valued string field
>  }
> ]'
> $ curl http://localhost:8983/api/collections/demo/update -d '
> [
>  {"id"         : "book1",
>   "author_s"   : {"set":"Neal Stephenson"},
>   "copies_i"   : {"inc":3},
>   "cat_ss"     : {"add":"Cyberpunk"}
>  }
> ]'
> {code}
> This results in the following document:
> {code}
> {
>         "id":"book1",
>         "author_s.set":["Neal Stephenson"],
>         "copies_i.inc":[3],
>         "cat_ss.add":["Cyberpunk"],
>         "_version_":1576306836595802112,
>         "cat_ss.add_str":["Cyberpunk"],
>         "author_s.set_str":["Neal Stephenson"]}]
>   }
> {code}
> Example from Yonik's blog: http://yonik.com/solr/atomic-updates/



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message