elasticsearch custom score formula - elasticsearch

I have a site that has a search using elasticsearch.
There is a rule that I need to implement:
the site is a search engine for women's products
but we have some stores that will pay to have their products appear on the site
we need to give priority to products from paying stores
We think the formula would be this:
store that is a customer (higher weight)
number of product views
Is there a way to use function_score to solve this?
and display the products randomly? (without blocking the list with only products from paying stores)

Related

Best approach to get products in order from database ??? based on product properties

I have to show products on my ecommerce website when user search query to My Elasticsearch
And having following features
Order by user previous preference
order by hot products

Sorting elasticsearch types based on child type property

I'm working on a e-commerce search page and need to free text search products and have multiple facet options and sorting capabilities. The issue I'm facing has to do with product prices:
One product has multiple prices - there are special discounts, B2B customer specific prices, and specific B2C prices. There could be a few hundred prices per product.
I need to be able to do to a full text search on products, but still be able to sort on one of the selected price groups.
My initial though would be to put all of the prices into the product item, but that means I'll need to update the product objects in the index every time a price changes - which is often. This will also make the objects quite big.
I see that elasticsearch now has the capability of HasParent/HasChildren queries, but I am not sure if that is the right way to go, or if it even is possible.
Is it possible to keep prices as a separate type outside the product type and use the HasParent/HasChilden queries to sort the procuts on the price?
My initial though would be to put all of the prices into the product item, but that means I'll need to update the product objects in the index every time a price changes - which is often. This will also make the objects quite big.
I would personally be inclined not to store complex pricing data within Elasticsearch, at least not prices calculated by business logic such as discounts and specific B2C prices.
A base price could be stored for querying and sorting, and apply pricing logic to this with scripting, using script queries and script sorting, respectively.
I see that elasticsearch now has the capability of HasParent/HasChildren queries, but I am not sure if that is the right way to go, or if it even is possible. Is it possible to keep prices as a separate type outside the product type and use the HasParent/HasChilden queries to sort the procuts on the price?
Parent/Child relationships operate on documents within a single index, with a join datatype field on a document to indicate the relationship between a parent and a child, and child documents indexed on the same shard as the parent. If children are not evenly distributed across parents/shards e.g. one parent document has a million children and the others have only a few each, it's possible to end up with hot spots within shards that can affect performance. Product and pricing data doesn't feel like a good fit for Parent/Child; pricing sounds like it's too dynamic to be stored within documents.

Search strategy for online application

I have an application with around 700 000 active products with actual stock quantity.
Each product can have multiple attributes and categories.
Product name, description and attributes can be delivered to the user in a few languages.
What I need to achive is fast search. By fast I mean that for example for product group which contains 250k of products I would like to return a first page of sorted results in 100ms.
My first thought was to deformalize data and push it into document db like elastic search. But there is one issue - product price: it depends on the user that is actually logged in.
Currently there will be 30k users. Each user can have different discount for each product category or even for each particular product. When discount or price is changed there is a business requirement to synchronize prices in a few minutes. Potentially system could compute prices for search results on fly, but there is an issue with sorting and pagination. When group consist of 250k products it will be hard to get results, compute price, sort and return given page.
Is there any way to return user dependent field in elastic search? Or I should rather start looking into some other solutions like graph databases?

Elasticsearch reduce score if id in list

I would like to give higher score for products not purchased yet by the user. We do not sell more than one piece of each product per user so there is no point to promote sold products to a user.
In some cases I filter out product based on id. But I would like to give a negative boost if id is in given list.
Any ideas how to implement this?
Well the best way to implement this would be as follows -
Maintain another index where each document has a field purchased which is an array holding docID's of purchased products.
Use function score query and use the function score function to depromote the purchased documents.
Use terms filter in the function score function. In terms filter , its possible to look up to a different document/field for the terms filter parameters. Utlize that to point to the purchased information
Provide boost as a negative value

Magento: reindex after import.csv (product dont show, all index are upgraded)

I have this problem I'm going crazy.
I imported new configurable products, see them in admin enabled, assigned to the category, assigned to the site but in front-end not seen!!
I re-updated indexes using SSH, but no result.
Moreover, there is a way to prevent that any editing I must re-index all the products? can I reindex only upgraded products or only new products.. is not possible for a single change I have to re-index from the first product!
My catalog have 25k products, but solving this i need to import other products (total 100K)
If there is among you that an expert can solve the problem, I am willing to pay (possibly an affordable price)
Regards,
Luca
Check whether you have quantity in stock (go to admin, then catalog, then look at one of the products). If the product has 0 units in stock, it will not show in the search results.

Resources