CodexBloom - Programming Q&A Platform

Elasticsearch 8.5 scenarios to Retrieve Documents After Upgrading from 7.16 - implementing Field Mapping

πŸ‘€ Views: 11 πŸ’¬ Answers: 1 πŸ“… Created: 2025-06-13
elasticsearch upgrade mapping json

I'm collaborating on a project where I keep running into I'm migrating some code and I'm wondering if anyone has experience with I've been struggling with this for a few days now and could really use some help... After upgrading from Elasticsearch 7.16 to 8.5, I'm experiencing issues where certain fields in my index are not being returned in search results, even though the documents exist. I've checked the mappings and it seems that the field types have changed after the upgrade, causing unexpected behavior. For example, a field that was previously indexed as `text` is now showing as `keyword`, which I believe is causing my `match` queries to unexpected result. Here’s a simplified example of my mapping before and after the upgrade: **Before Upgrade (7.16)**: ```json { "mappings": { "properties": { "title": { "type": "text" }, "tags": { "type": "keyword" } } } } ``` **After Upgrade (8.5)**: ```json { "mappings": { "properties": { "title": { "type": "keyword" }, "tags": { "type": "keyword" } } } } ``` I’ve attempted to run queries using both the `match` and `term` queries, but the `title` field currently being a `keyword` type is leading to no results being returned: ```json { "query": { "match": { "title": "Elasticsearch Upgrade" } } } ``` This query was previously returning results in 7.16. I've also tried re-indexing my data after the upgrade, but the scenario continues. The logs show no errors, but the absence of results is perplexing. Is there a recommended approach to handle field type changes during an upgrade? Should I redefine the mappings or adjust my queries to accommodate the new types? Any insights would be greatly appreciated. My development environment is Linux. Any help would be greatly appreciated! For reference, this is a production service. I'm working in a Debian environment. Any advice would be much appreciated.