Sort on array?


(Patrick) #1

Hi there,

I'm working on a fairly old codebase which is heavily using Elasticsearch query strings. Now I'm struggling with a new feature request. This would be a document example:

{
  "title": "My Literature",
  "category": "Books",
  "tags": [
    "Featured"
  ],
  "createdAt": "2016-08-02T17:53:46.428Z",
  "updatedAt": "2016-08-12T21:44:02.858Z"
}

I know my life could be a lot easier if "featured" would be an attribute or if I'd be using regular query DSL.

Instead, I have a querystring:

_type:literature AND category:Books

and want "featured" items to show up first in the list. All with the same query. I wonder if I can either boost the tag "featured" or do something like "sort": ["tags:Featured", "_score"]. I did try that already without success.

Thanks!


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.