Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8859587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:06:19+00:00 2026-06-14T15:06:19+00:00

I have an ElasticSearch database that has pages in it. class Page field :domain_id

  • 0

I have an ElasticSearch database that has “pages” in it.

class Page
  field :domain_id 
  field :page_id 
  field :title 
  field :description 
  field :filetype 
  field :content
end 

Each page has an ID of a domain. I’d like to be able to boost the results from a particular domain on all queries. So, if it matches a domain_id of X, set statically, it will be more relevant in every search result we return.

Second, I’d like to boost based on the text (which can be multiple words) matching the title or description with higher relevance, than matching the content for example.

I currently have the following query in the Tire gem.

query { text :_all, search_term } 

What should I add to do the 2 things above? If the user enters “title:policy manuals” (without quotes obviously), how will that affect things?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:06:21+00:00Added an answer on June 14, 2026 at 3:06 pm

    The first problem can be resolved by using Custom Filters Score Query with filter that would match domain_id. The second problem can be resolved by searching each field separately and applying appropriate boost factor. All together it may look something like this:

    {
      "custom_filters_score": {
        "query": {
          "bool": {
            "should": [
              {
                "text": {
                  "title": "SEARCH_TERM",
                  "boost": 2
                }
              },
              {
                "text": {
                  "description": "SEARCH_TERM",
                  "boost": 2
                }
              },
              {
                "text": {
                  "content": "SEARCH_TERM",
                  "boost": 1
                }
              }
            ]
          }
        },
        "filters": [
          {
            "filter": { "term": {"domain_id": "X"}},
            "boost": 3
          }
        ]
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

let's say that in my elasticsearch index I have a field called dots which
i have elasticsearch database of geo objects. I want to search the nearest objects
I'm running into an issue in that I have a document indexed with elasticsearch
I have a simple sounding problem according highlighting of a field with elasticsearch version
I have several models indexed with elasticsearch and one of them has an association
Is anyone aware of a .NET port of elasticsearch that has been implemented? We
I know that in elasticsearch, we can have child/parent relationships between documents. And then,
I have some customer documents that I want to be retrieved using ElasticSearch based
I have the following documents in ElasticSearch 0.19.11, using: { title: dogs species, col_names:
How do I define security access in Elasticsearch? I have the elasticsearch-head plugin but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.