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 rhys J <rh...@gmail.com> on 2019/12/13 16:23:10 UTC

Updates via curl and json not showing in api

When I do the following update:

curl http://localhost:8983/solr/debt/update -d '[ {"id": "393291-18625",
"orig_int_amt":{ "set" : "2.5"}, }]'

and then:

curl http://localhost:8983/solr/debt/get?id=393291-18625

I see the document is updated via the command line.

It shows the following:

{
  "doc":
  {
    "id":"393291-18625",
    "adjust_int":0.0,
    "adjust_princ":0.0,
    "clt_id":"8032",
    "clt_ref_no":"ORD150000096 000",
    "comments":" ",
    "debt_descr":"PO/XREF: 904-132985337, SHIPPER: BERGER AUSTIN",
    "debt_id":"393291",
    "debt_no":18625,
    "debt_type":"COM",
    "delq_date":"2015-02-08T00:00:00Z",
    "internal_adjustment":0,
    "list_date":"2015-01-13T00:00:00Z",
    "orig_clt":"8032",
    "orig_int_amt":2.5,
    "orig_princ_amt":49.3,
    "potential_bad_debt":0,
    "princ_paid":49.3,
    "reference_no":"invoice:ORD150000096 000",
    "serv_date":"2015-01-09T00:00:00Z",
    "status_code":520,
    "status_date":"2015-02-20T00:00:00Z",
    "storage_account":0,
    "time_stamp":"2015-01-13T06:09:00Z",
    "_version_":1652822026780409856}}

But when I use the Solr Web API, I get the following:

  {
        "id":"393291-18625",
        "adjust_int":0.0,
        "adjust_princ":0.0,
        "clt_id":"8032",
        "clt_ref_no":"ORD150000096 000",
        "comments":" ",
        "debt_descr":"PO/XREF: 904-132985337, SHIPPER: BERGER AUSTIN",
        "debt_id":"393291",
        "debt_no":18625,
        "debt_type":"COM",
        "delq_date":"2015-02-08T00:00:00Z",
        "internal_adjustment":0,
        "list_date":"2015-01-13T00:00:00Z",
        "orig_clt":"8032",
        "orig_int_amt":0.0,
        "orig_princ_amt":49.3,
        "potential_bad_debt":0,
        "princ_paid":49.3,
        "reference_no":"invoice:ORD150000096 000",
        "serv_date":"2015-01-09T00:00:00Z",
        "status_code":520,
        "status_date":"2015-02-20T00:00:00Z",
        "storage_account":0,
        "time_stamp":"2015-01-13T06:09:00Z",
        "_version_":1652734816636895232},

Notice that orig_int_amt is still 0.0.

How do I get the updates to show in the API?

Is there a step I'm missing?

Thanks,

Rhys

Re: Updates via curl and json not showing in api

Posted by rhys J <rh...@gmail.com>.
On Fri, Dec 13, 2019 at 11:51 AM Shawn Heisey <ap...@elyograg.org> wrote:


> > Is there a step I'm missing?
>
> It appears that you have not executed a commit that opens a new searcher.
>
>
Thanks for explaining this.

I turned on commit=true, and everything works as expected.

Thanks again,

Rhys

Re: Updates via curl and json not showing in api

Posted by Shawn Heisey <ap...@elyograg.org>.
On 12/13/2019 9:23 AM, rhys J wrote:
> When I do the following update:
> 
> curl http://localhost:8983/solr/debt/update -d '[ {"id": "393291-18625",
> "orig_int_amt":{ "set" : "2.5"}, }]'
> 
> and then:
> 
> curl http://localhost:8983/solr/debt/get?id=393291-18625
> 
> I see the document is updated via the command line.
> 
> It shows the following:
<snip>
>      "orig_int_amt":2.5,
<snip>
>          "orig_int_amt":0.0,
<snip>
> How do I get the updates to show in the API?
> 
> Is there a step I'm missing?

It appears that you have not executed a commit that opens a new searcher.

You can see the change in the realtime get handler (/get) which shows 
the latest version of documents, even those that have been indexed but 
aren't yet visible to normal searchers, but you can't see it when using 
the normal searcher.

https://lucene.apache.org/solr/guide/6_6/realtime-get.html

The simplest solution is to issue a commit and let Solr open a new searcher.

Example Solr configs are set up with autoCommit, using a 15 second 
maxTime, but in that config, openSearcher is set to false.  Which means 
that the automatic commits will NOT have their changes visible.  If you 
want changes to be automatically visible even if you never send an 
explicit commit, you'll need to set that up.

https://lucidworks.com/post/understanding-transaction-logs-softcommit-and-commit-in-sorlcloud/

That blog post says it is for SolrCloud, but its concepts are universal 
and do not depend on Solr running in cloud mode.

Thanks,
Shawn