🏡 Home 📖 Chapter Home 👈 Prev 👉 Next
⚡ ElasticsearchBook.com is crafted by Jozef Sorocin and powered by:
Documents often require updating — fields need to be incremented, modified, overwritten, or deleted. In this section we'll discuss situations where you:
I'm tracking visits to my site based on the slug. A sample entry in my site_visits
index:
POST site_visits/_doc/home_id
{
"slug": "/home",
"visits": 0,
"tags": ["landing", "ab_test_100"],
"unneeded_attribute": "old"
}
How do I
modified_at
field and set it to nowvisits
countab_test_100
tagunneeded
attribute?For adding new fields such as modified_at
, you may be tempted to repeat the POST
call from above with only the new field being present:
POST site_visits/_doc/home_id
{
"modified_at": "2020-12-05T14:11:41.634Z"
}