Sorting

Hi,

is there a way to have elasticsearch sort based on dependend
field-values instead of fields? Given:

attr : {
"name" : "filename",
"value" : "myFile.doc"
}

attr : {
"name" : "mimetype",
"value" : "application/msword"
}

attr : {
"name" : "mimetype",
"value" : "text/html"
}

Sorting should happen on the value-field of all attr with name="mimetype".

Is there a way to do this?

Best regards, --- Jan.

Hi,

with a custom_score and some coding you can achieve this, but it can
have strong impact on performance if you need to process _source to
sort documents.

If you have only mimetype attribute by document and you know you need
to sort on this value, I think it's better to directly put value in
another field to have direct sort.

Ludo

On Thu, Jun 9, 2011 at 10:31 AM, Jan Kriesten
kriesten@mail.footprint.de wrote:

Hi,

is there a way to have elasticsearch sort based on dependend
field-values instead of fields? Given:

attr : {
"name" : "filename",
"value" : "myFile.doc"
}

attr : {
"name" : "mimetype",
"value" : "application/msword"
}

attr : {
"name" : "mimetype",
"value" : "text/html"
}

Sorting should happen on the value-field of all attr with name="mimetype".

Is there a way to do this?

Best regards, --- Jan.

Hi Ludo,

thanks for your quick response.

There are many different attributes for documents and sorting needs to
be very flexible. So distinct fields are no option.

Given that sorting could happen on different attr (first: mimetype,
second: filename), that could easily get very complex. Defining a script
for the score and have multiple attr for sorting seems like a bad idea...

Best regards, --- Jan.

  • deleted -