Attribute depending combinated searches

Hi,

I have the following example scenario:

curl -XPUT 'http://localhost:9200/test/asset/1' -d '{
"asset" : {
"type" : "obj",
"attr" : [
{ "name" : "filename", "variants" : [ { "variant" : ["de_at",
"de_de", "en_gb", "en_us"], "value" : "myFile.doc" } ] },
{ "name" : "mimetype", "variants" : [ { "variant" : ["de_at",
"de_de", "en_gb", "en_us"], "value" : "application/msword" } ] },
{ "name" : "keywords", "variants" : [ { "variant" : ["de_at",
"de_de"], "value" : ["lebenslauf", "anschreiben"] }, { "variant" :
["en_gb", "en_us"], "value" : ["cv", "application"] } ] }
]
}
}'

curl -XPUT 'http://localhost:9200/test/asset/2' -d '{
"asset" : {
"type" : "obj",
"attr" : [
{ "name" : "filename", "variants" : [ { "variant" : ["de_at",
"de_de", "en_gb", "en_us"], "value" : "myOtherFile.doc" } ] },
{ "name" : "mimetype", "variants" : [ { "variant" : ["de_at",
"de_de", "en_gb", "en_us"], "value" : "application/msword" } ] },
{ "name" : "keywords", "variants" : [ { "variant" : ["de_at",
"de_de"], "value" : ["myFile.doc"] }, { "variant" : ["en_gb", "en_us"],
"value" : ["myOtherFile.doc"] } ] }
]
}
}'

Is it possible to search a certain attribute and from there in a
containing value?

E.g. search attr-name 'keywords' and all 'keywords' having variant
'en_gb' and value 'myOtherFile.doc'?

Best regards, Jan.

You can do this type of searches using bool queries for example. Note that multi valued "objects" are problematic since matches can be across entries in the object array. If you want "per" object matching then you need to separate it into different docs.

On Wednesday, May 25, 2011 at 8:43 PM, Jan Kriesten wrote:

Hi,

I have the following example scenario:

curl -XPUT 'http://localhost:9200/test/asset/1' -d '{
"asset" : {
"type" : "obj",
"attr" : [
{ "name" : "filename", "variants" : [ { "variant" : ["de_at",
"de_de", "en_gb", "en_us"], "value" : "myFile.doc" } ] },
{ "name" : "mimetype", "variants" : [ { "variant" : ["de_at",
"de_de", "en_gb", "en_us"], "value" : "application/msword" } ] },
{ "name" : "keywords", "variants" : [ { "variant" : ["de_at",
"de_de"], "value" : ["lebenslauf", "anschreiben"] }, { "variant" :
["en_gb", "en_us"], "value" : ["cv", "application"] } ] }
]
}
}'

curl -XPUT 'http://localhost:9200/test/asset/2' -d '{
"asset" : {
"type" : "obj",
"attr" : [
{ "name" : "filename", "variants" : [ { "variant" : ["de_at",
"de_de", "en_gb", "en_us"], "value" : "myOtherFile.doc" } ] },
{ "name" : "mimetype", "variants" : [ { "variant" : ["de_at",
"de_de", "en_gb", "en_us"], "value" : "application/msword" } ] },
{ "name" : "keywords", "variants" : [ { "variant" : ["de_at",
"de_de"], "value" : ["myFile.doc"] }, { "variant" : ["en_gb", "en_us"],
"value" : ["myOtherFile.doc"] } ] }
]
}
}'

Is it possible to search a certain attribute and from there in a
containing value?

E.g. search attr-name 'keywords' and all 'keywords' having variant
'en_gb' and value 'myOtherFile.doc'?

Best regards, Jan.

Hi Shay,

You can do this type of searches using bool queries for example. Note
that multi valued "objects" are problematic since matches can be across
entries in the object array. If you want "per" object matching then you
need to separate it into different docs.

ah, right. So an approach might be to index attribute lists as documents
and have a reference to the parent?!

Best regards, --- Jan.