Search code examples
angularelasticsearchfirebasefirebase-realtime-databaseisodate

After changing a property from a string to an object, elasticsearch can no longer index the data object


I've got some objects in a Firebase database which I'm using along with ElasticSearch to perform advanced queries.

However, when I had to change a property in one of those objects from a string, organizer: "some name" to organizer: {id: "someId", name: "some name"}, ElasticSearch can no longer index the object, saying:

[mapper_parsing_exception] failed to parse [organizer] Can't get text on a START_OBJECT

The data objects which remain as organizer: "" gets indexed properly, but the new structured objects does not. I don't understand why this is happening since I don't provide a custom mapping of these objects (I'm using Firebase Flashlight to make it easier).

Can someone with more knowledge let me know how I can resolve this issue? It's causing big problems since I can't search for those objects anymore.


Solution

  • When you indexed organizer: "some name" the first time, a new field of type string (or text) has been created.

    Now you try to index organizer: {id: "someId", name: "some name"} which is not a string anymore but an object, so that won't work.

    You need to delete your index and properly reindex your data.