Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attachment mapping #10

Closed
gkapitany opened this issue Jul 24, 2014 · 2 comments
Closed

attachment mapping #10

gkapitany opened this issue Jul 24, 2014 · 2 comments

Comments

@gkapitany
Copy link

Hi,
I'd like to add attachment mapping for:

https://github.com/elasticsearch/elasticsearch-mapper-attachments/

I not sure what is the correct way to do that. I would appreciate your help. Maybe would help to also update the documentation, in case somebody else needs it.
Here is the modified mapping I'm trying to use:

curl -XGET 'http://localhost:9200/imapriverdata/_mapping?pretty'
{
  "imapriverdata" : {
    "mappings" : {
      "imapriverstate" : {
        "properties" : {
          "errormsg" : {
            "type" : "string"
          },
          "exists" : {
            "type" : "boolean"
          },
          "folderUrl" : {
            "type" : "string"
          },
          "lastCount" : {
            "type" : "long"
          },
          "lastIndexed" : {
            "type" : "long"
          },
          "lastSchedule" : {
            "type" : "long"
          },
          "lastTook" : {
            "type" : "long"
          },
          "lastUid" : {
            "type" : "long"
          },
          "messageid" : {
            "type" : "string"
          },
          "uidValidity" : {
            "type" : "long"
          }
        }
      },
      "mail" : {
        "properties" : {
          "attachmentCount" : {
            "type" : "long"
          },
          "attachments" : {
            "properties" : {
              "attachmentType" : {
                "type" : "attachment",
                "path" : "full",
                "fields" : {
                  "attachmentType" : {
                    "type" : "string"
                  },
                  "author" : {
                    "type" : "string"
                  },
                  "title" : {
                    "type" : "string"
                  },
                  "name" : {
                    "type" : "string"
                  },
                  "date" : {
                    "type" : "date",
                    "format" : "dateOptionalTime"
                  },
                  "keywords" : {
                    "type" : "string"
                  },
                  "content_type" : {
                    "type" : "string"
                  },
                  "content_length" : {
                    "type" : "integer"
                  },
                  "language" : {
                    "type" : "string"
                  }
                }
              },
              "content" : {
                "type" : "string"
              },
              "contentType" : {
                "type" : "string"
              },
              "filename" : {
                "type" : "string"
              },
              "name" : {
                "type" : "string"
              },
              "size" : {
                "type" : "long"
              }
            }
          },
          "contentType" : {
            "type" : "string"
          },
          "flaghashcode" : {
            "type" : "integer"
          },
          "flags" : {
            "type" : "string"
          },
          "folderFullName" : {
            "type" : "string",
            "index" : "not_analyzed"
          },
          "folderUri" : {
            "type" : "string"
          },
          "from" : {
            "properties" : {
              "email" : {
                "type" : "string"
              },
              "personal" : {
                "type" : "string"
              }
            }
          },
          "headers" : {
            "properties" : {
              "name" : {
                "type" : "string"
              },
              "value" : {
                "type" : "string"
              }
            }
          },
          "mailboxType" : {
            "type" : "string"
          },
          "receivedDate" : {
            "type" : "date",
            "format" : "basic_date_time"
          },
          "sentDate" : {
            "type" : "date",
            "format" : "basic_date_time"
          },
          "size" : {
            "type" : "long"
          },
          "subject" : {
            "type" : "string"
          },
          "textContent" : {
            "type" : "string"
          },
          "to" : {
            "properties" : {
              "email" : {
                "type" : "string"
              },
              "personal" : {
                "type" : "string"
              }
            }
          },
          "uid" : {
            "type" : "long"
          }
        }
      }
    }
  }
}

I did restart elasticsearch after the change.

Thanks,
Gabriel

@salyh
Copy link
Owner

salyh commented Jul 25, 2014

First make sure you have set

"with_attachments":true
and, of course, you have installed the elasticsearch-mapper-attachments plugin.

Your mapping should look like this (surely without the the dots (...) and comments (//XXX))

"mail" : {
        "properties" : {
          
    //start   
          "attachments" : {
            "properties" : {
              "content" : { 
                "type" : "attachment" 
              },
              "contentType" : {
                "type" : "string"
              },
              "fileName" : {
                "type" : "string"
              },
              "size" : {
                "type" : "integer"
              }
            }
          },
                  
    //end     
          
        
          "bcc" : {
            "properties" : {
              "email" : {
                "type" : "string"
              },
              "personal" : {
                "type" : "string"
              }
            }
          },
          "cc" : {
          ...
          ...
                  //rest of the mapping

@gkapitany
Copy link
Author

Works now, thanks a lot for your help.

Gabriel

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

No branches or pull requests

2 participants