I am trying to build a search engine like search tool, similar to Google using the node.js client of elasticsearch.
Here is an example document:
{
title: "Audits of Alberta Energy Regulator Expose a Broken Agency",
url: "http://ipsum.com/alberta-energy-regulator-audits",
content "Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Etiam porta sem malesuada magna mollis euismod. Donec ullamcorper nulla non metus auctor fringilla. Nulla vitae elit libero, a pharetra augue...."
domainAuthorty: 23,
pageRank: 16,
spamScore: 5,
manualOffset: -5,
publishDate: 2020-05-19
}
- title: should have a high boost
- url: should have a high boost
- content: should have a medium boost based on full text
- domainAuthorty: should have a medium
- pageRank: should have a high boost
- spamScore: should have a high negative boost
- manualOffset: should have a high positive or negative boost
- publishDate: newer docs should have a low positive boost
domainAuthorty, pageRank, spamScore, manualOffset will change periodically, the other fields are static
The content field is a full text article and the only field that needs full-text support.
So far I have a basic search working:
results = await await client.search({
index: index,
body: {
query: {
function_score: {
query: { match_all: {} },
boost: "5",
functions: [
{
filter: { match: { title: term } },
// random_score: {},
weight: 42,
},
{
filter: { match: { content: term } },
weight: 10,
}
],
max_boost: 42,
score_mode: "max",
boost_mode: "multiply",
min_score: 42,
},
},
},
});
However this doesn't take in to account all of the factors. I'm not sure which type of query would be the best option?
-
something else?