我有不同類型的彈性搜索索引。 每種類型都包含一些默認字段和一些基於類型的額外字段。 每種類型都有位置對象,可以存儲緯度和經度。我在我的彈性搜索索引 的樣本數據是彈性搜索非法參數異常
[{
"_index": "es_index",
"_type": "type1",
"_id": "id1",
"_source": {
"name": "name",
"type1field": "value",
"location": {
"lat": 1,
"lon": 1
}
}
}, {
"_index": "es_index",
"_type": "type2",
"_id": "id2",
"_source": {
"name": "name",
"type2field": "value",
"location": {
"lat": 1,
"lon": 1
}
}
}]
我能夠創建通過「感」,但得到從Java應用程序中的錯誤同樣映射的索引。
我使用「org.springframework.data.elasticsearch.core.ElasticsearchTemplate」從我的Java應用程序創建彈性搜索索引。
我正在使用相同的ElasticsearchTemplate來保存和查詢數據。
當所有的不同類型有不同的對應文件創建索引,它是成功的,但是在保存數據,我得到錯誤的
3210而且我在所有的有「位置」相同的映射類型
"location": {
"geohash": true,
"lat_lon": true,
"store": true,
"type": "geo_point"
}
FYI-這裏是我的es_index映射
{
"es_index": {
"aliases": {
"es_index1": {}
},
"mappings": {
"type1": {
"properties": {
"field1": {
"type": "string",
"analyzer": "nGram_analyzer",
"search_analyzer": "whitespace_analyzer"
},
"field2": {
"type": "string",
"index": "no"
},
"field3": {
"type": "string",
"analyzer": "nGram_analyzer",
"search_analyzer": "whitespace_analyzer"
},
"field4": {
"type": "string",
"index": "no"
},
"location": {
"type": "geo_point",
"store": true,
"lat_lon": true,
"geohash": true
}
}
},
"type2": {
"properties": {
"field1": {
"type": "string",
"analyzer": "nGram_analyzer",
"search_analyzer": "whitespace_analyzer"
},
"field5": {
"type": "string",
"analyzer": "nGram_analyzer",
"search_analyzer": "whitespace_analyzer",
"include_in_all": true
},
"field4": {
"type": "string",
"index": "no"
},
"location": {
"type": "geo_point",
"store": true,
"lat_lon": true,
"geohash": true
},
"field6": {
"type": "string",
"index": "no"
}
}
}
},
"settings": {
"index": {
"creation_date": "1491466792565",
"include_in_all": "false",
"uuid": "uuid....",
"number_of_replicas": "1",
"analysis": {
"filter": {
"nGram_filter": {
"max_gram": "75",
"type": "edgeNGram",
"min_gram": "2",
"token_chars": [
"letter",
"digit",
"punctuation",
"symbol"
]
}
},
"analyzer": {
"nGram_analyzer": {
"type": "custom",
"filter": [
"lowercase",
"asciifolding",
"nGram_filter"
],
"tokenizer": "keyword"
},
"whitespace_analyzer": {
"type": "custom",
"filter": [
"lowercase",
"asciifolding"
],
"tokenizer": "keyword"
}
}
},
"number_of_shards": "8",
"version": {
"created": "2040499"
}
}
},
"warmers": {}
}
}
瓦在這是它的原因,我該如何解決它?
你可以發佈你的索引映射嗎? 'curl localhost:9200/es_index?pretty' – fylie
@fylie:我編輯了問題 – Raghavendra