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 7771373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:38:11+00:00 2026-06-01T16:38:11+00:00

I am using Facet Terms to get all the unique values and their count

  • 0

I am using Facet Terms to get all the unique values and their count for a field. And I am getting wrong results.

term: web 
Count: 1191979 
term: misc 
Count: 1191979 
term: passwd 
Count: 1191979 
term: etc 
Count: 1191979 

While the actual result should be:

term: WEB-MISC /etc/passwd 
Count: 1191979 

Here is my sample query:

{
  "facets": {
    "terms1": {
      "terms": {
        "field": "message"
      }
    }
  }
}
  • 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-01T16:38:12+00:00Added an answer on June 1, 2026 at 4:38 pm

    If reindexing is an option, it would be the best to change mapping and mark this fields as not_analyzed

    "your_field" : { "type": "string", "index" : "not_analyzed" }
    

    You can use multi field type if keeping an analyzed version of the field is desired:

    "your_field" : {
      "type" : "multi_field",
        "fields" : {
          "your_field" : {"type" : "string", "index" : "analyzed"},
          "untouched" : {"type" : "string", "index" : "not_analyzed"}
      }
    }
    

    This way, you can continue using your_field in the queries, while running facet searches using your_field.untouched.

    Alternatively, if this field is stored, you can use a script field facet instead:

    "facets" : {
      "term" : {
        "terms" : {
          "script_field" : "_fields.your_field.value"
        }
      }
    }
    

    As the last resort, if this field is not stored, but record source is stored in the index, you can try this:

    "facets" : {
      "term" : {
        "terms" : {
          "script_field" : "_source.your_field"
        }
      }
    }
    

    The first solution is the most efficient. The last solution is the least efficient and may take a lot of time on a large index.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Lucene to get frequency of terms in documents, i.e. number of occurrences
I have a problem with using facet. I need autocomplete and for this I
I'm plotting a group of curves, using facet in ggplot2. I'd like to have
I am using ggplot2 to plot a figure that contains nine facets. Each facet
We are using Oracle ADF Faces in a new web project. I am always
I have a Java based web-application using Java Server Faces and Facelets. I am
I'm thinking of switching from using PHP to Python for web applications, but I
I'm using private inheritance in a project, in the implemented in terms of-sense. The
When using wp_get_post_terms() I can produce a list of taxonomy terms associated with a
I need to query the table for all but keyword. Using just - doesn't

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.