Sorting on subset of values

There is some document I want to search on which contains multiple values
in one field - e.g. multiple dates.
Now I want to filter documents by those dates - for example later than
today - and then sort them by dates. But I would like to sort NOT on all
dates (which would be not relevant), but only on those later than today.

I cannot figure out how to achieve this simple scenario with Elasticsearch.
I have tried to use Script Based Sorting, make use of nested documents and
so on, but maybe I'm missing something really clear and simple.

--

What you want to do is not simple. I am also not quite sure what you are
trying to achieve. So, if you have several dates later than today, which
date are you going to use to sort on?

On Monday, January 14, 2013 3:33:51 AM UTC-5, jasisz wrote:

There is some document I want to search on which contains multiple values
in one field - e.g. multiple dates.
Now I want to filter documents by those dates - for example later than
today - and then sort them by dates. But I would like to sort NOT on all
dates (which would be not relevant), but only on those later than today.

I cannot figure out how to achieve this simple scenario with
Elasticsearch. I have tried to use Script Based Sorting, make use of nested
documents and so on, but maybe I'm missing something really clear and
simple.

--

I know - it is simple in relational world, but not here...

If I have several dates later than today I want to sort by the earliest one.

W dniu wtorek, 15 stycznia 2013 02:47:12 UTC+1 użytkownik Igor Motov
napisał:

What you want to do is not simple. I am also not quite sure what you are
trying to achieve. So, if you have several dates later than today, which
date are you going to use to sort on?

On Monday, January 14, 2013 3:33:51 AM UTC-5, jasisz wrote:

There is some document I want to search on which contains multiple values
in one field - e.g. multiple dates.
Now I want to filter documents by those dates - for example later than
today - and then sort them by dates. But I would like to sort NOT on all
dates (which would be not relevant), but only on those later than today.

I cannot figure out how to achieve this simple scenario with
Elasticsearch. I have tried to use Script Based Sorting, make use of nested
documents and so on, but maybe I'm missing something really clear and
simple.

--

I know - it is simple in relational world, but not here...

If I have several dates later than today I want to sort by the earliest one.

On Tuesday, January 15, 2013 2:47:12 AM UTC+1, Igor Motov wrote:

What you want to do is not simple. I am also not quite sure what you are
trying to achieve. So, if you have several dates later than today, which
date are you going to use to sort on?

On Monday, January 14, 2013 3:33:51 AM UTC-5, jasisz wrote:

There is some document I want to search on which contains multiple values
in one field - e.g. multiple dates.
Now I want to filter documents by those dates - for example later than
today - and then sort them by dates. But I would like to sort NOT on all
dates (which would be not relevant), but only on those later than today.

I cannot figure out how to achieve this simple scenario with
Elasticsearch. I have tried to use Script Based Sorting, make use of nested
documents and so on, but maybe I'm missing something really clear and
simple.

--

You can write a sort scripthttp://www.elasticsearch.org/guide/reference/api/search/sort.htmlthat would take a list of dates for the current document (using document
fields or stored fieldshttp://www.elasticsearch.org/guide/reference/modules/scripting.html)
throw out everything older than today and then return the smallest date.

On Tuesday, January 15, 2013 2:10:21 AM UTC-5, jasisz wrote:

I know - it is simple in relational world, but not here...

If I have several dates later than today I want to sort by the earliest
one.

On Tuesday, January 15, 2013 2:47:12 AM UTC+1, Igor Motov wrote:

What you want to do is not simple. I am also not quite sure what you are
trying to achieve. So, if you have several dates later than today, which
date are you going to use to sort on?

On Monday, January 14, 2013 3:33:51 AM UTC-5, jasisz wrote:

There is some document I want to search on which contains multiple
values in one field - e.g. multiple dates.
Now I want to filter documents by those dates - for example later than
today - and then sort them by dates. But I would like to sort NOT on all
dates (which would be not relevant), but only on those later than today.

I cannot figure out how to achieve this simple scenario with
Elasticsearch. I have tried to use Script Based Sorting, make use of nested
documents and so on, but maybe I'm missing something really clear and
simple.

--