Can different indexes contain different fields for the same object type?

I have a situation where I had an object, let's say called Person.

Originally, it had fields: A, B, C

I created 10 indexes, each for this Person object type. Indexed many values with it.

Later, we modified the Person class in our code, so now it has fields: A, B, C, D (i.e. we added Field D).

I found that attempting to index objects with the new field worked. However, searches for objects didn't seem to work properly.

I blew away one of the indexes and rebuilt it with the new fields for the Person object.

I found that searches on the rebuilt index still didn't work.

I blew away ALL indexes, and rebuilt them all, using the new Person fields... and THEN searching worked correctly.

So I was wondering - can you have a single Elasticsearch server with a single node, with multiple indexes, contain data for a given object, where the definition of that object is different between indexes? Should the above not have happened?

  • Tim

Hi,

without any details about the kind of query and the kind if field you added its a bit hard to answer this. Generally querying a field that does not exits (e.g. with a match query should be possible, however if you use that field in scripts or sort by it and then run your query against indices that don't contain it, you will get errors.