ElasticSearch for Attribute(Key) value data set

0down votefavoritehttp://stackoverflow.com/questions/18306833/elasticsearch-for-attributekey-value-data-set#
**

I am using Elasticsearch with Haystacksearch and Django and want to search
the follow structure:

{
{
"title": "book1",
"category" : ["Cat_1", "Cat_2"],
"key_values" :
[
{
"key_name" : "key_1",
"value" : "sample_value_1"
},
{
"key_name" : "key_2",
"value" : "sample_value_12"
}
]
},

{
    "title": "book2",
    "category" : ["Cat_3", "Cat_2"],
    "key_values" :
    [
        {
            "key_name" : "key_1",
            "value" : "sample_value_1"
        },
        {
            "key_name" : "key_3",
            "value" : "sample_value_6"
        },
        {
            "key_name" : "key_4",
            "value" : "sample_value_5"
        }
    ]
}

}

Right now I have set up an index model using Haystack with a "text" that
put all the data together and runs a full text search! In my opinion this
is not the a well established search 'cause I am not using my data set
structure and hence this is some kind odd.
As an example if for an object i have a key-value "{"key_name" :
"key_1","value" : "sample_value_1"}" and for another object I have
"{"key_name" : "key_2","value" : "sample_value_1"}" and we it gets a query
like "Key_1 sample_value_1" comes I get a thoroughly mixed result of
objects who have these words in their fields rather than using their
structures.

P.S. I am totally new to ElasticSearch and better to say new to the search
technologies and challenges. I have searched the web and SO button didn't
find anything satisfying. Please let me know if there is something wrong
with my thoughts and expectations from these search engines and if there is
SO duplicate question! And also if there is a better approach to design a
database for this kind of search

Thanks in advance!

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

If I understand your problem correctly, what you is probably occurring is
that you are searching the _all field:

Can you provide your mapping and an example query? By default, all fields
get aggregated into the _all field, and query_string queries with no stated
fields will use this field.

Also, nested objects might be better for your use case:

With nested objects, you can run a multi-field query and only match on
nested object that satisfy all the conditions.

Cheers,

Ivan

On Sun, Aug 18, 2013 at 10:24 PM, Mahdi Mazaheri me.mazaheri@gmail.comwrote:

0down votefavoritehttp://stackoverflow.com/questions/18306833/elasticsearch-for-attributekey-value-data-set#
**

I am using Elasticsearch with Haystacksearch and Django and want to search
the follow structure:

{
{
"title": "book1",
"category" : ["Cat_1", "Cat_2"],
"key_values" :
[
{
"key_name" : "key_1",
"value" : "sample_value_1"
},
{
"key_name" : "key_2",
"value" : "sample_value_12"
}
]
},

{
    "title": "book2",
    "category" : ["Cat_3", "Cat_2"],
    "key_values" :
    [
        {
            "key_name" : "key_1",
            "value" : "sample_value_1"
        },
        {
            "key_name" : "key_3",
            "value" : "sample_value_6"
        },
        {
            "key_name" : "key_4",
            "value" : "sample_value_5"
        }
    ]
}

}

Right now I have set up an index model using Haystack with a "text" that
put all the data together and runs a full text search! In my opinion this
is not the a well established search 'cause I am not using my data set
structure and hence this is some kind odd.
As an example if for an object i have a key-value "{"key_name" :
"key_1","value" : "sample_value_1"}" and for another object I have
"{"key_name" : "key_2","value" : "sample_value_1"}" and we it gets a query
like "Key_1 sample_value_1" comes I get a thoroughly mixed result of
objects who have these words in their fields rather than using their
structures.

P.S. I am totally new to Elasticsearch and better to say new to the search
technologies and challenges. I have searched the web and SO button didn't
find anything satisfying. Please let me know if there is something wrong
with my thoughts and expectations from these search engines and if there is
SO duplicate question! And also if there is a better approach to design a
database for this kind of search

Thanks in advance!

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.