Searching a specific field with a Hash value

I have a document under a type called "user". The user has different
attributes like this:

{
"id" : 3,
"location" : "New York",
"about_me" : "I like to surf, snowboard, and watch the Giants play.",
"interests" : {"extreme_sports" : "snowboard", "movies" : "inception"}
}

I want to search the user for data matching "snowboard", but only want to
look in the "interests" field. I've tried the following query:
{
"query" : {
"term" : {
"interests" : "snowboard"
}
}
}

I tried to restrict the search for the string "snowboard" to only the
"interests" field, however this returns no hits. I'm assuming it's because
the "interests" field contains a hash, not a simple string. How do I tell
elasticsearch to search for values within the "interests" field when it
contains a hash?

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/Searching-a-specific-field-with-a-Hash-value-tp3190358p3190358.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

Yes, its because it contains a "hash", the fields indexed are actually
interests.extreme_sports, .. . So, you need to query on those. That said, I
think that in certain queries, we can support automatically expanding
something like interests field (which maps to an object mapping) to all its
sub fields.

On Fri, Jul 22, 2011 at 7:17 AM, cdolive <christopherdavidolivares@gmail.com

wrote:

I have a document under a type called "user". The user has different
attributes like this:

{
"id" : 3,
"location" : "New York",
"about_me" : "I like to surf, snowboard, and watch the Giants play.",
"interests" : {"extreme_sports" : "snowboard", "movies" : "inception"}
}

I want to search the user for data matching "snowboard", but only want to
look in the "interests" field. I've tried the following query:
{
"query" : {
"term" : {
"interests" : "snowboard"
}
}
}

I tried to restrict the search for the string "snowboard" to only the
"interests" field, however this returns no hits. I'm assuming it's because
the "interests" field contains a hash, not a simple string. How do I tell
elasticsearch to search for values within the "interests" field when it
contains a hash?

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Searching-a-specific-field-with-a-Hash-value-tp3190358p3190358.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

Thanks Shay! Is there anywhere I can look to see which queries automatically expand and search on every hash value?

I said we can look into supporting that, there is no support for it
currently.

On Mon, Jul 25, 2011 at 10:03 PM, Kikster <
christopherdavidolivares@gmail.com> wrote:

Thanks Shay! Is there anywhere I can look to see which queries
automatically
expand and search on every hash value?

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Searching-a-specific-field-with-a-Hash-value-tp3193609p3198370.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.