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

Example with type_mapping #4

Closed
megastef opened this issue May 11, 2014 · 6 comments
Closed

Example with type_mapping #4

megastef opened this issue May 11, 2014 · 6 comments

Comments

@megastef
Copy link

I would like to add mapping for https://github.com/jprante/elasticsearch-langdetect
and get possibility to sort by receivedDate - so a custom mapping is required.

There is no documentation, what is expected in

 type_mapping - optional mapping for the Elasticsearch index type

I tried this:

"type_mapping" : {

                        "properties" : {
                           "textContent" : { "type" : "langdetect" },
                           "receivedDate" : { "type": "date"}
                        }

                    }

River creation was OK, but mapping not applied.
Then I used this one:

"type_mapping" : {
                      "mail" : {
                        "properties" : {
                           "textContent" : { "type" : "langdetect" },
                           "receivedDate" : { "type": "date"}
                        }
                      }
                    }

No effect on mapping. Of course I deleted river and index on each try ..

In both cases I got following response:

{"_index":"_river","_type":"stefan","_id":"_meta","_version":1,"created":true}
@salyh
Copy link
Owner

salyh commented May 11, 2014

The second is the one that should work. Unfortunately there is a bug in 0.0.6 preventing this. Try http://dl.bintray.com/salyh/maven/de/saly/elasticsearch/plugin/elasticsearch-river-imap/0.0.7-b11/elasticsearch-river-imap-0.0.7-b11-plugin.zip

@megastef
Copy link
Author

OK. Mapping got applied (not the one in the example, but another), I might update you when it works like I want. E.g. E-Mail address should be "not_analyzed" or multi-field (e.g. to make stats about sender/recipient).

@megastef
Copy link
Author

This mapping works for me now:

{
                      "mail" : {
                        "properties" : {
                           "textContent" : { "type" : "langdetect" },
                           "email" : {"type":"string", "index":"not_analyzed"},

                           "subject": {
                               "type": "multi_field",
                               "fields": {
                                   "text": { "type": "string" },
                                   "raw":   { "type": "string", "index": "not_analyzed" }
                               }
                           },
                           "personal": {
                              "type": "multi_field",
                              "fields": {
                                  "title": { "type": "string" },
                                  "raw":   { "type": "string", "index": "not_analyzed" }
                              }
                          }
                        }
                      }
}

@salyh
Copy link
Owner

salyh commented May 13, 2014

Will think about changing the default mapping as you suggested.

@salyh
Copy link
Owner

salyh commented May 13, 2014

Think you have typo in mapping: its sentDate instead of sendDate

@salyh
Copy link
Owner

salyh commented Sep 2, 2014

documentation updated with c32b262

@salyh salyh closed this as completed Sep 2, 2014
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