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 "Goston IV, Stanley W" <st...@lmco.com> on 2018/06/27 16:00:18 UTC

Solr Update

All,


I was wondering if it is possible to do a solr update by doing something like the following:



JSON:



{

  "add":{

    "doc":{

      "id_txt":"_query_:{q=title_txt:test.jpg fl=id_txt}",

      "title_txt": {"set":"Maybe"},

      "location_geo": {"set":"POINT(-108.5491667 57.71194444)"}

    }

  }

}



XML:


<add>

 <doc>

  <field name="id_txt"><query>q=title_txt:test.jpg fl=id_txt</query></field>

  <field name="title_txt" update="set">Maybe</field>

  <field name = "location_geo" update="set">POINT(-108.5491667 57.71194444)</field>

 </doc>

</add>


I need to be able to do a nested query to get the unique id since I do not know it without performing a query.

Stan Goston
Software Engineer
Lockheed Martin - RMS
Phone: 303-932-4543


Re: Solr Update

Posted by Shawn Heisey <ap...@elyograg.org>.
On 6/27/2018 10:00 AM, Goston IV, Stanley W wrote:
> I was wondering if it is possible to do a solr update by doing something like the following:
>
> JSON:
>
> {
>   "add":{
>     "doc":{
>       "id_txt":"_query_:{q=title_txt:test.jpg fl=id_txt}",
>       "title_txt": {"set":"Maybe"},
>       "location_geo": {"set":"POINT(-108.5491667 57.71194444)"}
>     }
>   }
> }
<snip>
> I need to be able to do a nested query to get the unique id since I do not know it without performing a query.

As far as I am aware, this is not possible.  Others probably know for
sure.  I have never heard of anything like this.

You will probably need to do the query in whatever software is building
the update requests before that part of the update is built.

Because your example update sets the field you're querying on to a new
value, that same query executed again isn't going to work after the
change is committed.

Thanks,
Shawn