Updates via curl and json not showing in api

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Updates via curl and json not showing in api

rhys J
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
Reply | Threaded
Open this post in threaded view
|

Re: Updates via curl and json not showing in api

Shawn Heisey-2
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
Reply | Threaded
Open this post in threaded view
|

Re: Updates via curl and json not showing in api

rhys J
On Fri, Dec 13, 2019 at 11:51 AM Shawn Heisey <[hidden email]> 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