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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:38:28+00:00 2026-06-17T13:38:28+00:00

I am using elasticsearch 0.20.2 on EC2 instance (16GB RAM, no swap enabled). I

  • 0

I am using elasticsearch 0.20.2 on EC2 instance (16GB RAM, no swap enabled). I have a lot indexed documents and when I try to do facet results I got heap space error and elasticsearch server is unusable then. I was increasing heap memory for java but nothing helps. So my question is can I limit number of documents on which facet will be applied.

Here is my settings and mapping:

my_settings = {
    'settings': {
        'analysis': {
            'analyzer': {
                'text_analyzer': {
                    'tokenizer': 'standard',
                    'filter': ['standard', 'lowercase']
                },
                'suggestions_analyzer': {
                    'tokenizer': 'standard',
                    'filter': ['suggestions_shingle']
                }
            },
            'filter': {
                'suggestions_shingle': {
                    'type': 'shingle',
                    'min_shingle_size': 2,
                    'max_shingle_size': 5
                }
            }
        }
    }
}

my_mapping = {
    'test-type':{
        'properties':{
            'publish_datetime': {'type': 'date'},
            'text': {
                'type': 'multi_field',
                'fields': {
                    'text': {'type': 'string', 'analyzer': 'text_analyzer', 'include_in_all': True},
                    'suggestions': {'type': 'string', 'analyzer': 'suggestions_analyzer', 'include_in_all': False}
                }
            }
        }
    }
}

and my search query is:

query = {
    'filtered': {
        'filter' : {
            'limit' : {'value' : 10}
        },
        'query':{
            'prefix':{
                    'text.suggestions': 'wha'
            }
        },
    },
    'facets':{
        'text_suggestions':{
            'terms':{
                'field':'text.suggestions',
                'regex':'^%s.*' % 'wha',
                'size': 5
            }
        }
    },
    'size': 0
}

Is someone succeed to limit document number which will be facet let share with us.

  • 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-17T13:38:29+00:00Added an answer on June 17, 2026 at 1:38 pm

    No, it is not possible to artificially limit the number of documents on which to run the aggregation — that aggregation would clearly be incorrect. The facets are limited by the query you issue (and also by any facet_filters you use).

    So, several ways to keep in mind:

    • In general, facets will be limited by the query you send to Elasticsearch
    • Values for fields you’re faceting on will be loaded into memory
    • There are some techniques to prevent out of memory errors for ad-hoc faceting, but they are not useful for regular user-exposed searching/faceting

    Please see the Estimating field cache size for facets in advance discussion on the mailing list.

    Based on the query you have posted, it’s not clearly what are you trying to do with faceting on the text.suggestions field?

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

Sidebar

Related Questions

I am trying to add documents to ElasticSearch. I have no problems using curl
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:
Do you have any suggestions how to perform authorization of elasticsearch results (using tire)
I am aware of how using the facet feature of elasticsearch, we can get
I'm using elasticsearch to index my documents. Is it possible to instruct it to
I have crawled some data using nutch and managed to inject it into elasticsearch.
Using elasticsearch, I'd like to get a histogram facet for a price field in
I'm using ElasticSearch to index documents. My mapping is: mongodocid: { boost: 1.0, store:
I know that in elasticsearch, we can have child/parent relationships between documents. And then,

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.