Thanks diptamay, I was expecting the response was that Elastic Search
isn't intended to be used for searching in this way. Let me clarify
my use a case a bit to explain my approach. A clearer example is
this:
{
"title" : ["Robin Hood",
{
"subtitle" : "Men in tights"
}]
}
Ideally, I'd like to be able to do a search on q?title:tights and have
this match, since the user may not distinguish the subtitle (they may
simply think it is "part of the title"). Semantically, subtitle is
a sub-object of title, and q?title.subtitle:tights should also
match, if I were searching at that level of specificity.
I shouldn't have to separate them into homogeneous units, since q?
title:tights still wouldn't match, eg:
{
"title" : "Robin Hood",
"subtitle" : "Men in tights"
}
And I lose the semantic label of "subtitle" if I do:
{
"title" : ["Robin Hood", "Men in tights"]
}
I've been following Elastic Search for a little while now, and for my
problem domain (library science), having an index which is data-model
neutral but still provides the advanced structure, faceting, etc.
features is an ideal solution that we have been waiting for a very
long time. Unfortunately, if I have to limit my JSON structure to
ordered arrays and key-value objects in order to be able to search
them, then it's not a viable option.
Shay (and thanks in advance for taking the time to look at my
question, I really appreciate it a lot), is there an architectural
reason why ES can't handle this kind of JSON construct in the way I
describe above? I can imagine from a performance perspective that
indexing a hierarchy would be potentially expensive, but I'd be
willing to make that trade-off for this kind of functionality.
MJ
On Tue, Jun 15, 2010 at 5:23 AM, diptamay dipta...@gmail.com wrote:
Instead of
{
"id" : ["81881",
{
"special" : "051110"
}]
}
Represent your json as
{
"id" : [81881, 051110]
}
Then if you query using q=id:81881 or q=id:051110, it will work.
Ideally you would want to keep your array elements homogenous.
On Jun 14, 4:49 pm, MJ Suhonos suho...@gmail.com wrote:
Apologies -- this got truncated. The document is actually quite
large, but the relevant portion (which does seem to get parsed fine by
ES and is valid JSON) is:
{
"id" : ["81881",
{
"special" : "051110"
}]
}
Thanks,
MJ
On Jun 14, 3:57 pm, Shay Banon shay.ba...@elasticsearch.com wrote:
Can you oust the json you index, the one you specified is not proper
JSON....
On Mon, Jun 14, 2010 at 10:45 PM, MJ Suhonos suho...@gmail.com
wrote:
Hi all,
Apologies if this is a silly question, but I'm still learning the
commonalities of JSON. I'm able to make a JSON structure which is
being indexed, but not queryable using object-dot-notation. eg. a
document with:
"id" : ["12345",
{
"special" : "09876"
}
If I do an open query for either value (eg. ?q=12345 or q?=09876), I
get the document. But, I cannot query for "id.special" or simply
"id" (eg. ?q=id:12345 or ?q=id.special:09876), neither match.
What I'm looking for is to be able to query a term in a "hierarchy"
and have it match values within/below, whether in objects, arrays,
etc
(eg. ?q=id:09876 would match). Am I searching incorrectly or is
there
a proper way to express this in JSON that ES could handle? Is
something like this even possible?
Thanks in advance,
MJ