I tried scripting, and it affects performance
Why can't you add update_date field with date type, and add one more range filter to query "new" documents?
For facets you could use range facets to separate old and new counts
Pergunta
I've been trying to work this one out and I've thought of a few days to do it but they all seem to have a flaw at some level - so this is what I'm trying achieve;
Let's say you have a bunch of items that are dated, let's say that some of those items can be classified as "new" but that's user preference but for argument sake, let's say, any items with a date of less than 3 months should be classified as new.
How would this be possible without creating a field and setting the value as "new"- the reason I don't want to do that is that "3 months" is user preference and any documents that get old, would need to be updated regularly.
The difficulty here also, is I'd like to create a facet from this too - is there an ideal way to do this or is it simply impossible without setting the value?
Thanks in advanced!
Solução
I tried scripting, and it affects performance
Why can't you add update_date field with date type, and add one more range filter to query "new" documents?
For facets you could use range facets to separate old and new counts
Outras dicas
What you could use a script inside your query. Scripts are able to use the values inside the document and can also add additional fields at query runtime like your new field. http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html
The facet should work on the normal date field right?