# Function Score Query based on dictionary

**URL:** https://discuss.elastic.co/t/function-score-query-based-on-dictionary/23228
**Category:** Elasticsearch
**Created:** [April 14, 2015, 1:21pm UTC](https://discuss.elastic.co/t/function-score-query-based-on-dictionary/23228 "2015-04-14T13:21:18Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![JZ1](https://avatars.discourse-cdn.com/v4/letter/j/958977/32.png) [@JZ1](https://discuss.elastic.co/u/JZ1)
#### Post date: [April 14, 2015, 1:21pm UTC](https://discuss.elastic.co/t/function-score-query-based-on-dictionary/23228/1 "2015-04-14T13:21:18Z")

</div>

Hi all,

Is it possible to apply a script on sort without using a numeric field, but  
one based on a string?

I want to to re-order the results based on a dictionary of values that  
exist in a field.

I have never tried scripts before, but if it is possible to write a  
cascaded statement, then I could apply boosting as well to do this trick.

Cheers

/JZ

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/bafffb49-7bdb-49bd-9ec8-8a76680ef64c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/bafffb49-7bdb-49bd-9ec8-8a76680ef64c%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 12:19am UTC](https://discuss.elastic.co/t/function-score-query-based-on-dictionary/23228/2 "2017-07-06T00:19:54Z")

</div>


