# Currency Field / Currency function

**URL:** https://discuss.elastic.co/t/currency-field-currency-function/194619
**Category:** Elasticsearch
**Created:** [August 9, 2019, 1:17pm UTC](https://discuss.elastic.co/t/currency-field-currency-function/194619 "2019-08-09T13:17:11Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![rosherd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rosherd/32/46087_2.png) [@rosherd](https://discuss.elastic.co/u/rosherd)
#### Post date: [August 9, 2019, 1:17pm UTC](https://discuss.elastic.co/t/currency-field-currency-function/194619/1 "2019-08-09T13:17:11Z")

</div>

Hi All,

I'm new to ES but in Solr I've implemented a custom ValueSourceParser that can read an exchange rate file, and using currency and currency\_amount fields, I can for example incorporate a USD value into the scoring.

I was thinking of writing a custom function score query, so then able to query something like:

GET /\_search  
{  
"query": {  
"function\_score": {  
"query": { "match\_all": {} }, #or whatever....  
"currency\_function": {  
"currency\_field": "currency",  
"amount\_field" : "currency\_amount",  
"default\_currency" : "USD",  
"exchange\_file" : "http://..."  
}  
}  
}  
}

Has this been done before and is this the best approach?

In ES How can I read the exchange file and if stored locally i.e. file://.... where can I store and how might I be able to read it.

Cheers,  
Dan

---

<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: [September 6, 2019, 1:17pm UTC](https://discuss.elastic.co/t/currency-field-currency-function/194619/2 "2019-09-06T13:17:16Z")

</div>

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