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


(maximilian.brodhun) #1

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/594a7efd-a12b-40ec-a13f-63d869350d5b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(maximilian.brodhun) #2

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/0e2a1f79-712b-4012-ab95-0eac36f70399%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Ivan Brusic) #3

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 (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 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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/0e2a1f79-712b-4012-ab95-0eac36f70399%40googlegroups.comhttps://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.

--
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.
To view this discussion on the web visit 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.


(Sentient6) #4

Thanks for the answer! Hope they make it soon.

But I searched a while and found this plugin.

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" ]
}
}
}
}
}


(system) #5