ElasticSearch Head and nested JSON

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ElasticSearch Head and nested JSON

caymanag
I have a question on how to use ES-Head with nested JSON documents.  The problem appears to be when the nested document re-uses field names.

Here is my sample document
{
  "a": {
    "b": {
      "c":"firstval",
      "b":"secondval"
    },
    "d": {
      "b":"thirdval"
    }
  }
}

I can successfully query this document using curl as follows:
curl -XGET 'localhost:9200/twitter/_search?q=tweet.a.b.b=secondval'
curl -XGET 'localhost:9200/twitter/_search?q=tweet.a.d.b=thirdval'

However, I cannot get this to work for both cases in ES-Head.

In the Browser tab, I see the one document

_index
_type
_id
_score
c
b
twittertweet11firstvalthirdval

Under Fields (on the left), I can only search for the a.b.b field.  It doesn't appear to allow me to search on the a.d.b field.

Under the Structured Query tab I can select either the a.b.b field or the a.d.b field.  However, the search does not succeed for the the a.d.b field.

The problem is apparently due to the repeated use of the same field name.  If I modify the document and rename the field a.d.b to a.d.somethingelse, then the queries work fine.

This isn't just an academic exercise.  My documents have numerous duplicate field names and it would be inconvenient to replace them with unique names.

ES-Head is an excellent tool.  Thank 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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: ElasticSearch Head and nested JSON

mobz-2
Hi,

  Please see issues tracking this problem on github for more info

https://github.com/mobz/elasticsearch-head/issues/36 (fixed) and
https://github.com/mobz/elasticsearch-head/issues/45 (not fixed)

Essentially, it's a design flaw dating from the earlier days of the project. I've fixed it on Structured Query, but it's a bit more tricky on the browser. There is a partial solution described on github. ymmv

-B


On Thursday, 21 February 2013 09:42:01 UTC+11, Cayman wrote:
I have a question on how to use ES-Head with nested JSON documents.  The problem appears to be when the nested document re-uses field names.

Here is my sample document
{
  "a": {
    "b": {
      "c":"firstval",
      "b":"secondval"
    },
    "d": {
      "b":"thirdval"
    }
  }
}

I can successfully query this document using curl as follows:
curl -XGET 'localhost:9200/twitter/_search?q=tweet.a.b.b=secondval'
curl -XGET 'localhost:9200/twitter/_search?q=tweet.a.d.b=thirdval'

However, I cannot get this to work for both cases in ES-Head.

In the Browser tab, I see the one document

_index
_type
_id
_score
c
b
twittertweet11firstvalthirdval

Under Fields (on the left), I can only search for the a.b.b field.  It doesn't appear to allow me to search on the a.d.b field.

Under the Structured Query tab I can select either the a.b.b field or the a.d.b field.  However, the search does not succeed for the the a.d.b field.

The problem is apparently due to the repeated use of the same field name.  If I modify the document and rename the field a.d.b to a.d.somethingelse, then the queries work fine.

This isn't just an academic exercise.  My documents have numerous duplicate field names and it would be inconvenient to replace them with unique names.

ES-Head is an excellent tool.  Thank 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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.