Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-10424

/update/docs/json is swallowing all fields

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 6.5, 7.0
    • Fix Version/s: None
    • Component/s: update
    • Labels:
      None

      Description

      I'm not sure when/how exactly this broke, but sending a list of documents to /update/json/docs is currently useless – regardless of what your documents contain, all you get is 3 fields: id, _version_, and a _src_ field containing your original JSON, but none of the fields you specified are added.

      Steps to reproduce...

      git co releases/lucene-solr/6.5.0
      ...
      ant clean && cd solr && ant server
      ...
      bin/solr -e techproducts
      ...
      curl 'http://localhost:8983/solr/techproducts/update/json/docs?commit=true' --data-binary @example/exampledocs/books.json -H 'Content-type:application/json'
      ...
      
      curl 'http://localhost:8983/solr/techproducts/query?q=id:978-1933988177'
      {
        "responseHeader":{
          "status":0,
          "QTime":5,
          "params":{
            "q":"id:978-1933988177"}},
        "response":{"numFound":1,"start":0,"docs":[
            {
              "id":"978-1933988177",
              "_src_":"{\n    \"id\" : \"978-1933988177\",\n    \"cat\" : [\"book\",\"paperback\"],\n    \"name\" : \"Lucene in Action, Second Edition\",\n    \"author\" : \"Michael McCandless\",\n    \"sequence_i\" : 1,\n    \"genre_s\" : \"IT\",\n    \"inStock\" : true,\n    \"price\" : 30.50,\n    \"pages_i\" : 475\n  }",
              "_version_":1563794703530328065}]
        }}
      

      Compare with using /update/json ...

      curl 'http://localhost:8983/solr/techproducts/update/json?commit=true' --data-binary @example/exampledocs/books.json -H 'Content-type:application/json'
      ...
      curl 'http://localhost:8983/solr/techproducts/query?q=id:978-1933988177'
      {
        "responseHeader":{
          "status":0,
          "QTime":0,
          "params":{
            "q":"id:978-1933988177"}},
        "response":{"numFound":1,"start":0,"docs":[
            {
              "id":"978-1933988177",
              "cat":["book",
                "paperback"],
              "name":"Lucene in Action, Second Edition",
              "author":"Michael McCandless",
              "author_s":"Michael McCandless",
              "sequence_i":1,
              "sequence_pi":1,
              "genre_s":"IT",
              "inStock":true,
              "price":30.5,
              "price_c":"30.5,USD",
              "pages_i":475,
              "pages_pi":475,
              "_version_":1563794766373584896}]
        }}
      

      According to the ref-guide, the only diff between these two endpoints should be that /update/json/docs defaults json.command=false ... but since the top level JSON structure in books.json is a list ("[ ... ]") that shouldn't matter because that's not the solr JSON command syntax.


      If you try to send a singular JSON document tp /update/json/docs, you get the same problem...

      curl -X POST -H 'Content-type:application/json' --data-binary '{"id":"HOSS","popularity":42}' 'http://localhost:8983/solr/techproducts/update/json/docs?commit=true'
      ...
      curl 'http://localhost:8983/solr/techproducts/query?q=id:HOSS'{
        "responseHeader":{
          "status":0,
          "QTime":0,
          "params":{
            "q":"id:HOSS"}},
        "response":{"numFound":1,"start":0,"docs":[
            {
              "id":"HOSS",
              "_src_":"{\"id\":\"HOSS\",\"popularity\":42}",
              "_version_":1563795188162232320}]
        }}
      

      ...even though the same JSON works fine to /update/json?json.command=false ...

      curl -X POST -H 'Content-type:application/json' --data-binary '{"id":"HOSS","popularity":42}' 'http://localhost:8983/solr/techproducts/update/json?commit=true&json.command=false'
      ...
      curl 'http://localhost:8983/solr/techproducts/query?q=id:HOSS'{
        "responseHeader":{
          "status":0,
          "QTime":1,
          "params":{
            "q":"id:HOSS"}},
        "response":{"numFound":1,"start":0,"docs":[
            {
              "id":"HOSS",
              "popularity":42,
              "_version_":1563795262581768192}]
        }}
      

        Attachments

        Issue Links

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              hossman Chris M. Hostetter

              Dates

              • Created:
                Updated:

                Issue deployment