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
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).
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.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.