I have dates mapped as strings, which was a mistake, and I need them mapped as longs so as to sort on them successfully (as I've been advised in previous threads - thanks!).
How can I handle this migration? A few options occur to me:
- Index into an completely new index. When it is done, switch over my queries.
- Create a new field. The old one (the string) is called "receivedDate" I could create "receivedDateAsLong" and then update all the documents to fill in that field. Once done, sort on that field.
- Do something with multi fields. In experiments, I found that I can take a non-multi field and turn it into a multi. However, I do wonder how I'd tell the sort which instance of the multi field to sort on.
- Something else I'm not thinking of that you might suggest.
Or, maybe none of these are the right idea. In my ideal world, I'd be left with 1 non-multi field with a long (the string field going away) and I would not need to rebuild an entirely new index. I don't know if that will be possible.
Also, if possible, I'd like to index the receivedDate field without having to get all the other fields. (I don't have the source anymore; I disabled it, and the original data for all the other fields is a pain for me to get at again). Again, this may not be possible, but it is a definite preference.