Questions tagged [update-by-query]
26 questions
0
votes
1 answer
Merging two nested fields with update_by_query
I'm trying to merge two nested fields from two different documents. The nested fields have objects inside of them.
I tried to load the nested array from the first document and add it to the nested field in the second document but had no luck. The…

Maged Makled
- 1,918
- 22
- 25
0
votes
1 answer
Update elastic search nested field based on query
I have an Elasticsearch index named pollstat with mapping as follows:
{
"pollstat" : {
"mappings" : {
"dynamic" : "false",
"properties" : {
"dt" : {
"properties" : {
"dte" : {
"type" :…

Apricot
- 2,925
- 5
- 42
- 88
0
votes
1 answer
Update all elasticsearch docs using a dict for input using Python
Update All Documents
Background Information
I have a use case where I need to update all documents in my index. My source looks similar to the below:
{
'hits': [
{'_index': 'main-index-v2',
'_type': '_doc',
'_id':…

Jenobi
- 368
- 4
- 12
0
votes
1 answer
Why bulk update never conflicts with update-by-query requests in Elasticsearch
I keep two scripts running, one sending bulk requests to index:
while true; do
s=$(tr -dc A-Za-z0-9 < /dev/urandom | head -c 10)
curl -s -X POST 'localhost:9200/test/_bulk' -H 'Content-Type: application/x-ndjson' -d \
'{ "update": {…

cosimoth
- 167
- 10
0
votes
1 answer
Python Elasticsearch update_by_query not working
I want to update multiple docs using update_by_query in elasticsearch.py (version 7.13.1)
My query is:
es_query = {
"query": {
"match": {"user_id.keyword": user_id}
# "bool": {
# "must": [{"term": {"user_id":…

Ankita Gupta
- 155
- 2
- 14
0
votes
1 answer
Is Update By Query API a good choice to update single document in elasticsearch?
I have a use case where I want to update the document without knowing its index. Currently I am querying by id and getting the index and then updating (2 operation).
Update By Query API seems to perform this use case in single operation. But I am…

Karthik Amar
- 31
- 1
- 5
0
votes
1 answer
Using UpdateByQueryRequest in java client
I am trying to use UpdateByQueryRequest in java. The problem is, I am getting different syntax suggestion in eclipse. I am using java RestHighLevelClient. Here is an example
import org.elasticsearch.index.reindex.UpdateByQueryRequest;
SearchRequest…

rock321987
- 10,942
- 1
- 30
- 43
0
votes
2 answers
cannot resolve symbol[string] when using updateByQuery with ElasticSearch
I have the following set-up:
mapping:
esClient.indices.putMapping({
index: 'tests',
body: {
properties: {
name: {
type: 'text',
},
lastName: {
type: 'text',
},
},
},
});
this is the result when…

Lucas Erlacher
- 23
- 1
- 2
- 7
0
votes
1 answer
Elastic update a field with json data
POST cars/_update_by_query
{
"query": {
"match_all": {}
},
"script": {
"inline": "ctx._source.addresses = [{country:'Country', countryCode : 'cr'}]",
"lang": "painless"
}
}
The script run successfully, no error raised, the…

SexyMF
- 10,657
- 33
- 102
- 206
0
votes
1 answer
Update numeric and float fields in elasticsearch client
I am bit new to elasticsearch client.
I have not done any type of predefined mapping to any field, because I might add some new field to the documents in future.
My data looks like this:-
{
"segmentId": "4700-b70e-881",
"segmentName":…

abinas patra
- 359
- 3
- 21
0
votes
0 answers
Is there a way to update a document with a Painless script without changing the order of unaffected fields?
I'm using Elasticsearch's Update by Query API to update some documents with a Painless script like this (the actual query is more complicated):
POST ts-scenarios/_update_by_query?routing=test
{
"query": {
"term": { "routing": { "value": "test"…

Glorfindel
- 21,988
- 13
- 81
- 109