Answer the question
In order to leave comments, you need to log in
What is the correct way to store documents in Elasticsearch?
Hello!
I can't figure out how to properly store and update data.
There are several objects related to each other, for example:
Clients objects
{
id: 1,
name: 'client 1',
tags: [
{
id: 1,
name: 'tag 1'
},
{
id: 2,
name: 'tag 2'
}
],
deals: [
{
id: 1,
name: 'deal 1',
tags: [
{
id: 1,
name: 'tag 1'
}
]
}
]
}
[
{
id: 1,
name: 'deal 1',
tags: [
{
id: 1,
name: 'tag 1'
}
]
},
{
id: 2,
name: 'deal 2',
tags: [
{
id: 2,
name: 'tag 2'
}
]
}
]
[
{
id: 1,
name: 'tag 1'
},
{
id: 2,
name: 'tag 2'
}
]
Answer the question
In order to leave comments, you need to log in
I won’t comment on the first part, but something tells me that you shouldn’t pull logic from SQL into NoSQL.
on update - yes, you can update and not add a record, you need to make a unique field in the index. it can be any field - if the value in this field matches the "inserted" and the existing record, the existing one will be updated.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question