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.
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.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.