Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Maybe you could use nested aggregations: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-nested-aggregation.html
It looks like bad design to me. I would store each price as some kind of vertical item.
Thanks for your feedback on this guys!
Some follow up questions:
I don't know what are vertical fields, but to me
public class Product { public int Id { get; set; } public string Name { get; set; } ... [ElasticProperty(Type = FieldType.Nested)] public IList<CustomerPrice> Prices { get; set; } }
is more readable / maintainable than
public class Product { public int Id { get; set; } public string Name { get; set; } ... public decimal CustomerPrice1 { get; set; } public decimal CustomerPrice2 { get; set; } ... public decimal CustomerPrice1000 { get; set; } }
You shouldn't worry too much about complex queries.
Your biggest concern will be performance / memory consumption.
For example, I've worked a lot with Apache Solr.
You can implement typeahead search in so many different ways: suggester component, ngrams, wildcard queries, etc.
Some queries are fast / take very little memory with < 10 000 documents, while others perform much better with bigger number of documents.
"List<CustomerPrice> Prices" looks vertical in my mind.
While fields/single properties as below I figure as a horizontal structure.
public decimal CustomerPrice1 { get; set; }
public decimal CustomerPrice2 { get; set; }
...
public decimal CustomerPrice1000 { get; set; }
In other words I totally agree with Dejan :-)
We are in the process of planning a fairly large B2B EpiServer E-commerce site where Find will play a central role.
There are up to 850.000 products that will be published to the site - and over 1000 existing customers that will use the site.
One of the challenges is that each customer have their own prices (per product).
I have done some initial testing with ElasticSearch - index'ing all 850.000 products. I also added 1000 extra fields for each product: CustomerPrice_1 ... CustomerPrice_1000 - with a random value (for testing purposes).The index now takes about 12 GB on disk, 1 GB Ram (depending on traffic/caching I guess) - not bad.
When searching for *Kniv* sorted by CustomerPrice_999 asc - it takes 61ms to do the search itself and also 117ms to transfer the searchresult to the browser (1000 mbit network). The size of the search result is about 2.5 MB - this could be reduced greatly (making the search even faster) by only including prices for Customer_999.
So - the ElasticSearch performance here seems very promising - and it also makes searching/sorting/pagination etc. very easy.
Before we decide to go for this approach - I have a few questions: