Skip to content
This repository was archived by the owner on Dec 18, 2021. It is now read-only.

Support for attachment type #5

Closed
richardwilly98 opened this issue Oct 24, 2013 · 5 comments
Closed

Support for attachment type #5

richardwilly98 opened this issue Oct 24, 2013 · 5 comments

Comments

@richardwilly98
Copy link

Is there a way to use this plugin with attachment type?

@richardwilly98
Copy link
Author

@jprante
Copy link
Owner

jprante commented Oct 25, 2013

2.0.1 support base64 encoded UTF-8 texts.

Example added to README how to use langdetect with attachment mapper plugin.

@jprante jprante closed this as completed Oct 25, 2013
@richardwilly98
Copy link
Author

@jprante that's perfect.

One more request I would need to store the language code using "store": "yes":

PUT my_index
{
  "mappings" : {
    "docs" : {
      "properties" : {
        "file" : {
          "type" : "attachment",
          "fields" : {
            "file" : {
              "type" : "multi_field",
              "fields" : {
                "file" : {
                  "type" : "string", 
                  "store": "yes"
                },
                "language" : {
                  "type" : "langdetect",
                  "store": "yes"
                }
              }
            }
          }
        }
      }
    }
  }
}

Resulting mapping does not show store: true:

{
   "docs": {
      "properties": {
         "file": {
            "type": "attachment",
            "path": "full",
            "fields": {
               "file": {
                  "type": "multi_field",
                  "fields": {
                     "file": {
                        "type": "string",
                        "store": true
                     },
                     "language": {
                        "type": "langdetect",
                        "fields": {
                           "language": {
                              "type": "string"
                           },
                           "lang": {
                              "type": "string"
                           }
                        }
                     }
                  }
               },

Is that possible?

@jprante
Copy link
Owner

jprante commented Nov 5, 2013

Sure. You have to treat the langdetect type like a multifield.

Like this:

curl -XPUT 'localhost:9200/test'  -d '
{
  "mappings" : {
    "_default_" : {
      "properties" : {
        "content" : {
          "type" : "attachment",
          "fields" : {
            "content" : {
              "type" : "multi_field",
              "fields" : {
                "content" : { "type" : "string" },
                "language" : { 
                   "type" : "langdetect",
                   "fields" : {
                      "language" : { "type" : "string", "store" : true },
                      "lang" : { "type" : "string", "store" : true }
                   }
                }
              }  
            }
          }
        }
      }
    }
  }
}
'

@richardwilly98
Copy link
Author

Great! Thank you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants