Using the following structures which are representative of the problem, but
are not my structures.
[
{
"User" : "Marcus",
"Content" : {
"Content" : "This is a post",
"Title" : "The title of this post"
},
"Media" : {
"Header" : "http://.../images/one.jpg"
}
},
{
"User" : "Marcus",
"Content" : {
"Content" : "This is another post, but without a header",
"Title" : "The title of this other post"
}
}
]
I'd like to be able to find all documents with a "Media" object. The
workaround the OP used in the linked thread was to use one of the core keys
in the "Media" object, but I can't use any of its keys because they differ
between documents.
Using the following structures which are representative of the problem,
but are not my structures.
[
{
"User" : "Marcus",
"Content" : {
"Content" : "This is a post",
"Title" : "The title of this post"
},
"Media" : {
"Header" : "http://.../images/one.jpg"
}
},
{
"User" : "Marcus",
"Content" : {
"Content" : "This is another post, but without a header",
"Title" : "The title of this other post"
}
}
]
I'd like to be able to find all documents with a "Media" object. The
workaround the OP used in the linked thread was to use one of the core keys
in the "Media" object, but I can't use any of its keys because they differ
between documents.
The "media" key I used in my example is a user-specified key in both
insertion and retrieval so I would require keys for all objects of this
type.
I see that using a boolean value for a representative key (an escape
character prepended to the relevant key) would solve the search problem,
but the results are returned directly in an API in which the "search only"
keys are not appropriate.
I would have to manually remove all keys which began with the escape
character which would be intensive as currently the source string is not
evaluated to a JSON object in my application before transmission.
I can also see how this can be achieved without evaluating the JSON source
of the document by iterating through the string and recognising the unique
set of characters that represent the existence of a "search only" key and
removing it, but this is also reasonably intensive.
Is this the best option in your opinion?
Thanks
On Wednesday, 25 April 2012 16:55:59 UTC+1, kimchy wrote:
Can you add such a field? it can be a simple thing like "media" : true.
Using the following structures which are representative of the problem,
but are not my structures.
[
{
"User" : "Marcus",
"Content" : {
"Content" : "This is a post",
"Title" : "The title of this post"
},
"Media" : {
"Header" : "http://.../images/one.jpg"
}
},
{
"User" : "Marcus",
"Content" : {
"Content" : "This is another post, but without a header",
"Title" : "The title of this other post"
}
}
]
I'd like to be able to find all documents with a "Media" object. The
workaround the OP used in the linked thread was to use one of the core keys
in the "Media" object, but I can't use any of its keys because they differ
between documents.
Yea, currently, you will have to add your own field that said "exists" in
the Media object. We could, potentially, add a flag in the mapping of
object to automatically add an "object._exists" field for you? Does it make
sense?
The "media" key I used in my example is a user-specified key in both
insertion and retrieval so I would require keys for all objects of this
type.
I see that using a boolean value for a representative key (an escape
character prepended to the relevant key) would solve the search problem,
but the results are returned directly in an API in which the "search only"
keys are not appropriate.
I would have to manually remove all keys which began with the escape
character which would be intensive as currently the source string is not
evaluated to a JSON object in my application before transmission.
I can also see how this can be achieved without evaluating the JSON source
of the document by iterating through the string and recognising the unique
set of characters that represent the existence of a "search only" key and
removing it, but this is also reasonably intensive.
Is this the best option in your opinion?
Thanks
On Wednesday, 25 April 2012 16:55:59 UTC+1, kimchy wrote:
Can you add such a field? it can be a simple thing like "media" : true.
Using the following structures which are representative of the problem,
but are not my structures.
[
{
"User" : "Marcus",
"Content" : {
"Content" : "This is a post",
"Title" : "The title of this post"
},
"Media" : {
"Header" : "http://.../images/one.jpg"
}
},
{
"User" : "Marcus",
"Content" : {
"Content" : "This is another post, but without a header",
"Title" : "The title of this other post"
}
}
]
I'd like to be able to find all documents with a "Media" object. The
workaround the OP used in the linked thread was to use one of the core keys
in the "Media" object, but I can't use any of its keys because they differ
between documents.
I think for completeness and for intuitive use the exists filter should be
usable with object keys. I was surprised to find that this hasn't been
discussed much before as I can see quite generic use cases.
Is there any way I can include this functionality in my own setup or will I
have to wait for a new build?
Thanks for your help Shay
On Friday, 27 April 2012 10:06:46 UTC+1, kimchy wrote:
Yea, currently, you will have to add your own field that said "exists" in
the Media object. We could, potentially, add a flag in the mapping of
object to automatically add an "object._exists" field for you? Does it make
sense?
The "media" key I used in my example is a user-specified key in both
insertion and retrieval so I would require keys for all objects of this
type.
I see that using a boolean value for a representative key (an escape
character prepended to the relevant key) would solve the search problem,
but the results are returned directly in an API in which the "search only"
keys are not appropriate.
I would have to manually remove all keys which began with the escape
character which would be intensive as currently the source string is not
evaluated to a JSON object in my application before transmission.
I can also see how this can be achieved without evaluating the JSON
source of the document by iterating through the string and recognising the
unique set of characters that represent the existence of a "search only"
key and removing it, but this is also reasonably intensive.
Is this the best option in your opinion?
Thanks
On Wednesday, 25 April 2012 16:55:59 UTC+1, kimchy wrote:
Can you add such a field? it can be a simple thing like "media" : true.
Using the following structures which are representative of the problem,
but are not my structures.
[
{
"User" : "Marcus",
"Content" : {
"Content" : "This is a post",
"Title" : "The title of this post"
},
"Media" : {
"Header" : "http://.../images/one.jpg"
}
},
{
"User" : "Marcus",
"Content" : {
"Content" : "This is another post, but without a header",
"Title" : "The title of this other post"
}
}
]
I'd like to be able to find all documents with a "Media" object. The
workaround the OP used in the linked thread was to use one of the core keys
in the "Media" object, but I can't use any of its keys because they differ
between documents.
At the end of the day, exists filter works on what gets indexed, nothing
gets indexed for an object, except for its fields. You can add a field to
the object you care about in the json yourself (like exists or something
similar) and then check on it.
I think for completeness and for intuitive use the exists filter should be
usable with object keys. I was surprised to find that this hasn't been
discussed much before as I can see quite generic use cases.
Is there any way I can include this functionality in my own setup or will
I have to wait for a new build?
Thanks for your help Shay
On Friday, 27 April 2012 10:06:46 UTC+1, kimchy wrote:
Yea, currently, you will have to add your own field that said "exists" in
the Media object. We could, potentially, add a flag in the mapping of
object to automatically add an "object._exists" field for you? Does it make
sense?
The "media" key I used in my example is a user-specified key in both
insertion and retrieval so I would require keys for all objects of this
type.
I see that using a boolean value for a representative key (an escape
character prepended to the relevant key) would solve the search problem,
but the results are returned directly in an API in which the "search only"
keys are not appropriate.
I would have to manually remove all keys which began with the escape
character which would be intensive as currently the source string is not
evaluated to a JSON object in my application before transmission.
I can also see how this can be achieved without evaluating the JSON
source of the document by iterating through the string and recognising the
unique set of characters that represent the existence of a "search only"
key and removing it, but this is also reasonably intensive.
Is this the best option in your opinion?
Thanks
On Wednesday, 25 April 2012 16:55:59 UTC+1, kimchy wrote:
Can you add such a field? it can be a simple thing like "media" : true.
Using the following structures which are representative of the
problem, but are not my structures.
[
{
"User" : "Marcus",
"Content" : {
"Content" : "This is a post",
"Title" : "The title of this post"
},
"Media" : {
"Header" : "http://.../images/one.jpg"
}
},
{
"User" : "Marcus",
"Content" : {
"Content" : "This is another post, but without a header",
"Title" : "The title of this other post"
}
}
]
I'd like to be able to find all documents with a "Media" object. The
workaround the OP used in the linked thread was to use one of the core keys
in the "Media" object, but I can't use any of its keys because they differ
between documents.
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.