ElasticSearch1.7.3 Root type mapping not empty after parsing 오류 보고!
코드는 다음과 같습니다.
try
{
XContentBuilder mapping = XContentFactory.jsonBuilder().startObject().startObject("xivaik").startObject("properties").startObject("ajmc").field("type", "string")
.field("store", "yes").endObject().startObject("ajbh").field("type", "string").field("store", "yes").field("index", "not_analyzed").endObject()
.startObject("jyaq").field("type", "string").field("indexAnalyzer", "ik").field("searchAnalyzer", "ik").field("index", "analyzed").endObject()
.startObject("addDate").field("type", "date").endObject().endObject().endObject().endObject();
PutMappingRequest mappingRequest = Requests.putMappingRequest("xivaik").type("infoaj").source(mapping);
client.admin().indices().putMapping(mappingRequest).actionGet();
}
catch (IOException e)
{
e.printStackTrace();
}
실행 중 Root type mapping not empty after parsing 오류가 발생했습니다!
나중에 이 게시물을 보고 나에게 약간의 깨우침을 주었다.
I removed the "mappings" json object and it fixed the issue.
http://stackoverflow.com/questions/29304374/elasticsearch-java-root-type-mapping-not-empty-after-parsing
마핑 리퀘스트를 구축하고 있는 것 같습니다. 노드 중복 구조가 생겼습니다.
내가 구성하고자 했던 정보는 다음과 같다.
{"xivaik":{"properties":{"ajmc":{"type":"string","store":"yes"},"ajbh":{"type":"string","store":"yes","index":"not_analyzed"},"jyaq":{"type":"string","indexAnalyzer":"ik","searchAnalyzer":"ik","index":"analyzed"},"addDate":{"type":"date"}}}}
startObject("xivaik")가 내 색인xivaik를 구조 정보에 추가했지만 Requests.putMappingRequest("xivaik").type ("infoaj") 에서 색인xivaik를 지정했는데, 중복된 것 같지 않습니다.
없애다putMappingRequest("xivaik")는 불가능하기 때문에 구조를 구축하는 문장에서 startObject("xivaik")를 제거한 결과 성공적으로 실행되었습니다.
try
{
XContentBuilder mapping = XContentFactory.jsonBuilder().startObject().startObject("properties").startObject("ajmc").field("type", "string")
.field("store", "yes").endObject().startObject("ajbh").field("type", "string").field("store", "yes").field("index", "not_analyzed").endObject()
.startObject("jyaq").field("type", "string").field("indexAnalyzer", "ik").field("searchAnalyzer", "ik").field("index", "analyzed").endObject()
.startObject("addDate").field("type", "date").endObject().endObject().endObject();
PutMappingRequest mappingRequest = Requests.putMappingRequest("xivaik").type("infoaj").source(mapping);
client.admin().indices().putMapping(mappingRequest).actionGet();
}
catch (IOException e)
{
e.printStackTrace();
}
결과는 앞의 추측을 증명했다.나중에 참고해 주셨으면 좋겠습니다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.