https://github.com/futil-js/contexture-elasticsearch
Elasticsearch Provider for Contexture
https://github.com/futil-js/contexture-elasticsearch
contexture
Last synced: 4 months ago
JSON representation
Elasticsearch Provider for Contexture
- Host: GitHub
- URL: https://github.com/futil-js/contexture-elasticsearch
- Owner: futil-js
- License: mit
- Archived: true
- Created: 2017-09-29T02:09:20.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-07-17T02:41:44.000Z (7 months ago)
- Last Synced: 2024-09-09T15:17:40.279Z (6 months ago)
- Topics: contexture
- Language: JavaScript
- Homepage:
- Size: 2.6 MB
- Stars: 5
- Watchers: 13
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.es-mappings.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
ES mappings are returned with different shapes depending on the elasticsearch version.
This is a breakdown of those differences with JSON examples.## es5
- allows multple types per index.
- GET INDEX/_mapping shows type names.After:
POST /twitter/users
POST /twitter/tweetsGET twitter/_mapping
```json
{
"twitter": {
"mappings": {
"users": {
"properties": {
"message": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"post_time": {
"type": "date"
},
"username": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},
"tweets": {
"properties": {
"message": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"post_time": {
"type": "date"
},
"username": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
```## es6
- allows a type to be specified when POSTing but only one type is allowed.
- If no type specified, _doc is used.
- GET INDEX/_mapping shows type names.
- not sure how to import an es5 index to see what multi-type looks like.After:
POST /twitter/tweetsGET twitter/_mapping
```json
{
"twitter": {
"mappings": {
"tweets": {
"properties": {
"message": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"post_time": {
"type": "date"
},
"username": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
```After:
POST /twitterGET twitter/_mapping
```json
{
"twitter": {
"mappings": {
"_doc": {
"properties": {
"message": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"post_time": {
"type": "date"
},
"username": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
```## es7
- allows a type to be specified when POSTing but only one type allowed.
- If no type specified, _doc is used.
- GET INDEX/_mapping DOES NOT show the type.
- GET INDEX/_mapping?include_type_name DOES show the type.After:
POST /twitter/tweetsGET twitter/_mapping
```json
{
"twitter": {
"mappings": {
"properties": {
"message": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"post_time": {
"type": "date"
},
"username": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
```After:
POST /twitter/tweetsGET twitter/_mapping?include_type_name
```json
{
"twitter": {
"mappings": {
"tweets": {
"properties": {
"message": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"post_time": {
"type": "date"
},
"username": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
```