# Is it possible to get the name of the field above an element?

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-get-the-name-of-the-field-above-an-element/17536>\
**Category:** Elasticsearch\
**Created:** [May 15, 2014, 2:48pm UTC](https://discuss.elastic.co/t/is-it-possible-to-get-the-name-of-the-field-above-an-element/17536 "2014-05-15T14:48:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![maximilian\_brodhun](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@maximilian\_brodhun](https://discuss.elastic.co/u/maximilian_brodhun)\
**Post date:** [May 15, 2014, 2:48pm UTC](https://discuss.elastic.co/t/is-it-possible-to-get-the-name-of-the-field-above-an-element/17536/1 "2014-05-15T14:48:20Z")

</div>

Hello dear all,

the last days I struggle with queries and structures to index and query  
stuff like this.

{"project" :

```
  {
      "set1" : {
          "title" : "A",
          "id" : "1234",
          "fulltext" : "Some Text"
      },
  
        "set2" : {
        "title": "Believe",
        "id": "5678",
        "fulltext": "inside the fied"
      },
      
      "set3" : {
        "title": "imagination",
        "id": "9",
        "fulltext": "makes trouble" 
      }
  }

```

}

So, when I'm searching for "inside the field" I just want to get back all  
field from "set1".

The problem is, that the exact name of the field "set\*" ist not known. I  
know that the stuff I want to do is a little bit cruel. But it would be  
nice to get it working.

I tried queries like this:

{  
"query" : {  
"query\_string" : {  
"query" : "praedicatum"  
}  
},  
"\_source" : {  
"includes" : ["project"],  
"excludes" : [null]  
}  
}

But in this way, of course I get back the all entries of the field  
"project".

thanks to you!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/594a7efd-a12b-40ec-a13f-63d869350d5b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/594a7efd-a12b-40ec-a13f-63d869350d5b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![maximilian\_brodhun](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@maximilian\_brodhun](https://discuss.elastic.co/u/maximilian_brodhun)\
**Post date:** [May 15, 2014, 2:54pm UTC](https://discuss.elastic.co/t/is-it-possible-to-get-the-name-of-the-field-above-an-element/17536/2 "2014-05-15T14:54:17Z")

</div>

Additional:

At the beginning I had all entries in an array. But By searching for the  
strings I got also back the wohle array.  
The document looks in this way:

{  
"project" :

```
[ 
      {   
         "title" : "A",
         "id" : "1234",
         "fulltext" : "Some Text"

      },
  
        {
           "title": "Believe",
        "id": "5678",
        "fulltext": "inside the fied"

      },
      
      {
        "title": "imagination",
        "id": "9",
        "fulltext": "makes trouble" 
      }
]

```

}

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/0e2a1f79-712b-4012-ab95-0eac36f70399%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0e2a1f79-712b-4012-ab95-0eac36f70399%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [May 16, 2014, 7:05am UTC](https://discuss.elastic.co/t/is-it-possible-to-get-the-name-of-the-field-above-an-element/17536/3 "2014-05-16T07:05:33Z")

</div>

You currently can only get all of the original document (minus the  
excludes) when using inner/nested documents. There is currently an open  
issue, but I do not think there has been any progress until the search  
refactor is completed:  
[https://github.com/elasticsearch/elasticsearch/issues/3022](https://github.com/elasticsearch/elasticsearch/issues/3022) (no need for  
more +1s, the team knows about the issue)

--  
Ivan

On Thu, May 15, 2014 at 7:54 AM, [maximilian.brodhun@googlemail.com](mailto:maximilian.brodhun@googlemail.com) wrote:

> Additional:
> 
> At the beginning I had all entries in an array. But By searching for the  
> strings I got also back the wohle array.  
> The document looks in this way:
> 
> {  
> "project" :
> 
> ```
> [
> {
> "title" : "A",
> 
> "id" : "1234",
> "fulltext" : "Some Text"
> 
> },
> 
> {
> 
> "title": "Believe",
> "id": "5678",
> "fulltext": "inside the fied"
> 
> },
> 
> {
> 
> "title": "imagination",
> "id": "9",
> "fulltext": "makes trouble"
> }
> 
> ]
> 
> ```
> 
> }
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/0e2a1f79-712b-4012-ab95-0eac36f70399%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0e2a1f79-712b-4012-ab95-0eac36f70399%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/0e2a1f79-712b-4012-ab95-0eac36f70399%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0e2a1f79-712b-4012-ab95-0eac36f70399%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBvJAYTdGTAKSq9FMHKiUphO9-hCotd%3DvUAR-dEfx9B2Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBvJAYTdGTAKSq9FMHKiUphO9-hCotd%3DvUAR-dEfx9B2Q%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Sentient6](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@Sentient6](https://discuss.elastic.co/u/Sentient6)\
**Post date:** [May 16, 2014, 11:22am UTC](https://discuss.elastic.co/t/is-it-possible-to-get-the-name-of-the-field-above-an-element/17536/4 "2014-05-16T11:22:48Z")

</div>

Thanks for the answer! Hope they make it soon.

But I searched a while and found this plugin.

> **[wikimedia/search-highlighter](https://github.com/wikimedia/search-highlighter)**
>
> search-highlighter - Github mirror of "search/highlighter" - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer\_access for contributing

It doesn't solute the problem at all, but till the team make it, it will work!

With this query I get want I want:

{  
"\_source": false,  
"query": {  
"term": {  
"project.fulltext": "so"  
}  
},  
"highlight": {  
"fields": {  
"project.fulltext": {  
"type": "experimental",  
"options": {  
"fetch\_fields": ["project.id", "project.title"]  
}  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:28am UTC](https://discuss.elastic.co/t/is-it-possible-to-get-the-name-of-the-field-above-an-element/17536/5 "2017-07-06T01:28:58Z")

</div>


