My question is: Can we only update using script? Any sample code for this..?
Can I simply update value of any already indexed field?
As far as I know script is the only way to update a document. As long
as the _source of document is stored you can update any field of
document.
Example showing how to update a title field:
Node node = nodeBuilder().client(true).node();
Client client = node.client();
String index = "my_index";
String type= "my_type";
String id = "1";
String newTitle = "my new title";
client.prepareUpdate(index, type, id)
.setScript("ctx._source.title="" + newTitle + """)
.execute()
.actionGet();
I hava one more question if you can help me in this.
In elasticsearch, as we know, while querying we can give various aspects of
querying.
One category is Query_and_fetch v/s Query_then_fetch.
Also one more add on we can provide is the dfs query with both of them.
I heard one of the vedio of Shay Banon explaining dfs query and he
mentioned that
in case of dfs, there is an additional phase in which frequencies from all
the shards
is gathered.
*I am not sure what he means by frequencies. Is it just the distributed
term frequencies *
*or it also takes into account the distributed inverse document frequencies?
*
Thanks in advance.
On Monday, July 30, 2012 3:46:38 AM UTC-7, Martijn v Groningen wrote:
Hi Ajasuja,
My question is: Can we only update using script? Any sample code for
this..?
Can I simply update value of any already indexed field?
As far as I know script is the only way to update a document. As long
as the _source of document is stored you can update any field of
document.
Example showing how to update a title field:
Node node = nodeBuilder().client(true).node();
Client client = node.client();
String index = "my_index";
String type= "my_type";
String id = "1";
String newTitle = "my new title";
client.prepareUpdate(index, type, id)
.setScript("ctx._source.title="" + newTitle + """)
.execute()
.actionGet();
The dfs phase helps with computing more accurate scores.
In the dfs phase on each shard for all terms that match the query the
document frequency is computed.
Each dfs shard result is merged and the merged result is used as input
for the idf part of the score computing in the
query phase.
I hava one more question if you can help me in this.
In elasticsearch, as we know, while querying we can give various aspects of
querying.
One category is Query_and_fetch v/s Query_then_fetch.
Also one more add on we can provide is the dfs query with both of them.
I heard one of the vedio of Shay Banon explaining dfs query and he mentioned
that
in case of dfs, there is an additional phase in which frequencies from all
the shards
is gathered.
I am not sure what he means by frequencies. Is it just the distributed term
frequencies
or it also takes into account the distributed inverse document frequencies?
Thanks in advance.
On Monday, July 30, 2012 3:46:38 AM UTC-7, Martijn v Groningen wrote:
Hi Ajasuja,
My question is: Can we only update using script? Any sample code for
this..?
Can I simply update value of any already indexed field?
As far as I know script is the only way to update a document. As long
as the _source of document is stored you can update any field of
document.
Example showing how to update a title field:
Node node = nodeBuilder().client(true).node();
Client client = node.client();
String index = "my_index";
String type= "my_type";
String id = "1";
String newTitle = "my new title";
client.prepareUpdate(index, type, id)
.setScript("ctx._source.title="" + newTitle + """)
.execute()
.actionGet();
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.