acabala
acabala

Reputation: 149

Normalize elasticsearch query/results

I am building some website that is heavily based on search engine and I consider using Elasticsearch for displaying most relevant results to customer needs.

One of important features will be to have some price filters, like ones you can find on Airbnb, that allows you to narrow results. The issue I have, is that my objects are not unified, so I can have price per person, price per hour etc, so they will differ - depends which additional parameters will user choose.

My question is, is it possible with ElasticSearch (I suppose so), and how to deal with displaying that kind of results. Can engine handle it, or should I try to make an effort to normalize it somehow before pushing it to Elastic? What I have found is, that there are some script filters, where I can do math operations, but I'm not sure is this a good approach.

Upvotes: 0

Views: 673

Answers (1)

silvestrelosada
silvestrelosada

Reputation: 55

Scripts are good to calculate the score of the queries, real time calculations but for normalization of data, from my experience is better to normalize before sent to ES. So my suggestion, based on my experience, is to make the normalization before send the data to ES.

At the end you'll have some code that makes the normalization, in one case you need to implement it in ES script language (groovy) and in the other in the language that you're using to send data to ES. So it will be easy for you to implement it, and you can have different kind of normalizations.

Upvotes: 1

Related Questions