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

  • SEARCH
  • Home
  • 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 8375707
In Process

The Archive Base Latest Questions

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

My model has a tags field, which is an array of tags. The problem

  • 0

My model has a tags field, which is an array of tags. The problem I’m having is I want the tags to work like keywords, but ES is somehow breaking them into spaces for the purposes of faceting.

The mapping is:

indexes :tags, type: :array

The query for popular tags is:

tire.search do
  facet 'tags' do
    terms :tags, size: 100
  end
end

Now what results is individual words. e.g. A record tagged [“retro music”, “awesome”] will end up having three separate tags. Similarly, if I do a query to search on “retro music” (must { term 'tags', options[:tag] }), that will fail, while a query on “retro” or “music” will succeed. The desired behaviour here is that the tag should be atomic, so only a “retro music” (or “awesome”) tag search should succeed.

  • 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-09T15:14:46+00:00Added an answer on June 9, 2026 at 3:14 pm

    By default, elasticsearch analyzes strings using the “standard” analyzer, which converts strings to lowercase, splits them into words and removes some frequently occurring words (stopwords). You can prevent elasticsearch from doing all that by turning off analyzer for the field tags:

    indexes :tags, :type => 'string', :index => :not_analyzed 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My blog post model has a many-to-many field for tags: tags = models.ManyToManyField(PostTag) But
I have a Ticket model which has_many :tags . I would like to find
I am having that problem that my model dont want to save. I have
I have an Entry model which has many Tag s. Tag s are added
my Project model has 2 datetime atttributes: start_date and end_date. Now I want all
Which data-access model has the best performance and speed for a C# Winforms application?
If a model has an attribute named unit for example, but in your views
I have a small problem. I am making a site that has Tags and
I would like to create a form which has multiple input fields corresponding to
My user model has three relations for the same message model, and is using

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.