我想从我的elixir config.exs文件创建一个Elasticsearch 7.x索引:
config :app_core,App.Tools.ElasticsearchCluster,url: System.get_env("ELASTIC_HOST"),# username: "username",# password: "password",api: Elasticsearch.API.HTTP,json_library: Poison,indexes: %{
indie: %{
settings: "priv/elasticsearch/indies.json",store: App.Tools.ElasticSearch.Indie.Store,sources: [App.Data.Schema.Indie],bulk_page_size: 5000,bulk_wait_interval: 15_000
}
}
priv/elasticsearch/indies.json
以
{
"mappings": {
"_doc": {
"properties": {
"category" : {
"type": "nested","properties" : {
但是,当我尝试创建索引时,出现错误
"The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true."
有人知道如何在我引用的上下文中解决此问题(将其置于特定查询的前面是行不通的)吗?
应阿萨尔·阿兹兰(Assael Azran)的要求,以下是完整的indies.json:
{
"mappings": {
"_doc": {
"properties": {
"category" : {
"type": "nested","properties" : {
"all_parents" : {
"type" : "keyword"
},"direct_parent" : {
"type" : "keyword"
},"paths" : {
"type" : "keyword"
}
}
},"slug": {
"type": "keyword"
},"parent_id": {
"type": "integer","index": false
},"images": {
"type": "nested","properties": {
"indie_url": {
"type": "text","index": false
}
}
},"tenant": {
"type": "keyword"
},"suggest_keywords": {
"type": "completion","contexts": [
{
"name": "tenant","type": "category"
}
]
},"name": {
"type": "text"
},"description": {
"type": "text","updated_at": {
"type": "date"
},"string_facet": {
"type": "nested","properties": {
"id": {
"type": "keyword"
},"value": {
"type": "keyword"
}
}
},"number_facet": {
"type": "nested","value": {
"type": "double"
}
}
}
}
}
}
}