سؤال

How would you structure indices/types for an eshop application? Such an eshop would consist of domain objects like product, category, tag, manufacturer etc. The fulltext search results page should display intermixed list of all domain objects.

I can think of two options:

  1. One index per whole application, every domain object as a type.
  2. Every domain object has its own index, the type is the same - "item".

Which option will scale better?

The most of the "items" in the database are products. Some products aren't yet/anymore available. How to boost currently available products?

The fulltext should prefer to show categories/manufacturers on top of the page. How to boost certain types / objects from certain index?

هل كانت مفيدة؟

المحلول

For better performance i suggest first option is better one.

1)"One index per whole application, every domain object as a type."

2)Consider you create an index named "eshop".And types such as mobile,book etc

3)Because you can query according to your user input.Consider you create a shopping website like flipkart.In search user can search with plain keyword.

4)Now you can search in Elasticsearch with only mentioning index name.If user refer sum filter like mobile,range 1000-10000.you need to search inside mobile type,moreover we can easily filter in Elasticsearch.it will reduce your execution memory and CPU.

To boost available products.Add a field called "available" in your document.And while searching mentions boost value for available product.Example:

    {
      "query": {
        "term": {
          "available": true
        }
      }
      "boost": 1.5
    }

For more Boosting refer

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-boosting-query.html

http://jontai.me/blog/2013/01/advanced-scoring-in-elasticsearch/

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top