Multiple mappings with attachment

Hi,

I have the following problem - we need to index some documents by criteria:
a) data in attachments(I use attachment plugin for this)
b) some set of attributes(e.g. country, color)

The search is done by both of them(something like "a document containing
elasticsearch and country=USA"). So my question is if I can create the
following mapping:
curl -X PUT "localhost:9200/search/data/_mapping" -d '{
"attachment" : {
"properties" : {
"file" : {
"type" : "attachment",
"fields" : {
"title" : { "store" : "yes" },
"file" : { "term_vector":"with_positions_offsets", "store":"yes" }
}
}
},
"color" : { "type" : "string" },
"category" : { "type" : "string" }
}
}'

and use one index instead of doing some legwork in application. What I
could not find how to do is:

  1. Update fields separately(especially if I can update the attachment field
    with "prepareUpdate")
  2. Perform boolean query on few fields(e.g. attachment field + category)
  3. If it could be done in some other way(but using the same index, because
    using few indexes and finding intersections on client-side doesn't seem to
    bee a good solution for me)

Thanks in advance

--

i believe that this is possible but you should put color and category
inside the properties:

'{
"attachment" : {
"properties" : {
"file" : {
"type" : "attachment",
"fields" : {
"title" : { "store" : "yes" },
"file" : { "term_vector":"with_positions_offsets", "store":"yes" }
}
},
"color" : { "type" : "string" },
"category" : { "type" : "string" }
}
}
}

On Monday, 13 August 2012 18:28:23 UTC+10, Oleg Ievtushok wrote:

Hi,

I have the following problem - we need to index some documents
by criteria:
a) data in attachments(I use attachment plugin for this)
b) some set of attributes(e.g. country, color)

The search is done by both of them(something like "a document containing
elasticsearch and country=USA"). So my question is if I can create the
following mapping:
curl -X PUT "localhost:9200/search/data/_mapping" -d '{
"attachment" : {
"properties" : {
"file" : {
"type" : "attachment",
"fields" : {
"title" : { "store" : "yes" },
"file" : { "term_vector":"with_positions_offsets", "store":"yes"
}
}
}
},
"color" : { "type" : "string" },
"category" : { "type" : "string" }
}
}'

and use one index instead of doing some legwork in application. What I
could not find how to do is:

  1. Update fields separately(especially if I can update the attachment
    field with "prepareUpdate")
  2. Perform boolean query on few fields(e.g. attachment field + category)
  3. If it could be done in some other way(but using the same index, because
    using few indexes and finding intersections on client-side doesn't seem to
    bee a good solution for me)

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.