# Searching over Multiple Index

**URL:** https://discuss.elastic.co/t/searching-over-multiple-index/153264
**Category:** Elasticsearch
**Created:** [October 21, 2018, 2:37am UTC](https://discuss.elastic.co/t/searching-over-multiple-index/153264 "2018-10-21T02:37:26Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![han1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/han1/32/20141_2.png) [@han1](https://discuss.elastic.co/u/han1)
#### Post date: [October 21, 2018, 2:37am UTC](https://discuss.elastic.co/t/searching-over-multiple-index/153264/1 "2018-10-21T02:37:26Z")

</div>

Hi everyone,

Imaging you have 3 indexes:  
Index US has prices in US Dollars  
Index EU has prices in Euro  
Index UK has prices in Pound Sterling

Now you want to search all of the indexes for docs that have a price of 100 US Dollars.

if one uses a statement like this  
ISearchResponse searchResponse =  
await ElasticSearchConfig.GetClient().SearchAsync(x =\> x.Index("USIndex, EUIndex, UKIndex")

how can we normalize the price between all indexes. i.e.  
If searching Index US use 100  
If searching Index UK use 100 converted to UK Pounds say 100/1.5  
If searching Index EU use 100 converted to Euro say 100/1.25

Any assistance would be appreciated.

---

<div class="post-metadata">

### Author: ![klof](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/klof/32/31590_2.png) [@klof](https://discuss.elastic.co/u/klof)
#### Post date: [October 21, 2018, 8:36am UTC](https://discuss.elastic.co/t/searching-over-multiple-index/153264/2 "2018-10-21T08:36:56Z")

</div>

I think you should have 3 price fields per index :

- price.dollars
- price.sterling
- price.euro

Then, when indexing the documents, you can convert all the possible values, and after for the searches you would just have to search with the proper field (ex. "price.dollars" : 100, on all the indices).

---

<div class="post-metadata">

### Author: ![han1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/han1/32/20141_2.png) [@han1](https://discuss.elastic.co/u/han1)
#### Post date: [October 21, 2018, 5:39pm UTC](https://discuss.elastic.co/t/searching-over-multiple-index/153264/3 "2018-10-21T17:39:42Z")

</div>

Hi klof,  
Thanks for responding but the problem is:

1- There are a variable number of currencies and I do not want to have 100 extra fields .

2- The exchange rates varies, so you cant store prices at point of indexing

Any other ides?

---

<div class="post-metadata">

### Author: ![klof](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/klof/32/31590_2.png) [@klof](https://discuss.elastic.co/u/klof)
#### Post date: [October 23, 2018, 5:38am UTC](https://discuss.elastic.co/t/searching-over-multiple-index/153264/4 "2018-10-23T05:38:26Z")

</div>

Yes I get your point,  
So the other approach, would be to use a script query by passing the different currency rates in parameter. The script query is used in a filter context so the source must return a boolean value.

[https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-script-query.html#\_custom\_parameters](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-script-query.html#_custom_parameters)

---

<div class="post-metadata">

### Author: ![han1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/han1/32/20141_2.png) [@han1](https://discuss.elastic.co/u/han1)
#### Post date: [October 23, 2018, 12:08pm UTC](https://discuss.elastic.co/t/searching-over-multiple-index/153264/5 "2018-10-23T12:08:41Z")

</div>

Hi klof,  
Thanks for responding.

If you know scripting, any chance of a sample query using NEST, as we are not very proficient at this.

Many Thanks

---

<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: [November 20, 2018, 12:08pm UTC](https://discuss.elastic.co/t/searching-over-multiple-index/153264/6 "2018-11-20T12:08:41Z")

</div>

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