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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:18:28+00:00 2026-06-10T05:18:28+00:00

I have a problem with using elastic search at the moment. When I try

  • 0

I have a problem with using elastic search at the moment. When I try to perform a search and only want a subset of the fields returned, I need to specify the fields using a dot-notation if the fields are nested. Here’s a sample of my mapper json document which maps my couchDB document:

{
    "product": {
        "_type": {"store": "yes"},
        "_source": {"compress": true},
        "index_analyzer": "standard",
        "search_analyzer": "standard",
        "dynamic_date_formats": ["date_time_no_millis", "date_optional_time"],
        "properties": {
              "_id": {"type": "string", "store": "yes", "index": "not_analyzed"},
            "key": {"type": "string", "store": "yes"},
            "content": {
                "type": "object",
                "path": "just_name",
                "properties": {
                    "key": {"type": "string", "store": "yes"},
                    "name": {"type": "string", "store": "yes", "index_name": "name"},
                    "description": {"type": "string", "store": "yes", "index_name": "description"},
                    "brand": {
                        "type": "object",
                        "index_name": "brand",
                        "properties": {
                            "abbreviation": {"type": "string", "store": "yes", "index_name": "brand_abbreviation"},
                            "name": {"type": "string", "store": "yes", "index_name": "brand_name"}
                        }
                    }
                                }
                        }
                 }
          }
}

Referring to _id would just be a simple _id, but say I wanted to refer to name in the content, I would have to refer to it as content.name. The problem with this is that when the search output is out, the json output contains the field name as: “content.name”.

Is it possible to rename this as “name” and without the “content.” prefix? You can see, I tried to specify index_name, but that seemed useless.

  • 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-10T05:18:30+00:00Added an answer on June 10, 2026 at 5:18 am

    You can use partial_fields to do this.

    For instance, if you index a doc like this:

    curl -XPUT 'http://127.0.0.1:9200/test/test/1?pretty=1'  -d '
    {
       "email" : "john@foo.com",
       "name" : "john",
       "foo" : {
          "bar" : {
             "baz" : 1
          }
       }
    }
    '
    

    You can include the fields/objects that you want like this:

    curl -XGET 'http://127.0.0.1:9200/test/test/_search?pretty=1'  -d '
    {
       "partial_fields" : {
          "doc" : {
             "include" : [
                "name",
                "foo.*"
             ]
          }
       }
    }
    '
    

    Which will give you a result like this: (note the missing email field, and that field foo remains a hash – it is not flattened with dot notation)

    {
       "hits" : {
          "hits" : [
             {
                "_score" : 1,
                "fields" : {
                   "doc" : {
                      "name" : "john",
                      "foo" : {
                         "bar" : {
                            "baz" : 1
                         }
                      }
                   }
                },
                "_index" : "test",
                "_id" : "1",
                "_type" : "test"
             }
          ],
          "max_score" : 1,
          "total" : 1
       },
       "timed_out" : false,
       "_shards" : {
          "failed" : 0,
          "successful" : 5,
          "total" : 5
       },
       "took" : 1
    }
    

    On a side note, some comments about your mapping:

    • your _id field (which I assume is meant to be the elasticsearch ID, not an external ID) is at the wrong level – it should be at the same level as _type. If it IS an external ID, then it’s at the right level.
    • Why are you storing all your fields? There really is no need – it just uses extra resources. Unless you have a massive _source field, it is much faster to retrieve just that field and parse it, rather than hitting the disk for each individual field.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem using the SSIS. I try to import data from database
I have a problem using Semaphore in threading.. this is my situation, i want
I have problem using Fluent Nhibernate, I have following model. When I try to
I have a problem using the Java search function in Eclipse on a particular
I have problem using arabic font for iOS. All fonts have the same render,
i have problem using LIKE structure in DB2 : for example: select * from
I have problem while using jquery maskedinput with asp.net textbox. I have a check
I have a problem using a local SQL Server CE database with C# and
I have a problem using Linq to NHibernate to load an object and eagerly
I have a problem using JSON and arrays. Here is my code: while($row =

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.