2013-02-11 1 views
3

속성 이름 -> 속성 값의 해시 인 obj_properties 속성을 사용하여 문서의 색인을 생성합니다. elasticsearch는 속성 값 중 일부가 날짜라고 추측하여 날짜로 파싱 할 수없는 동일한 속성에 대한 후속 값을 발견하면 다음 오류를 발생시킵니다.Tire의 elasticsearch 매핑에서 날짜 감지 기능을 사용하지 않음

org.elasticsearch.index.mapper.MapperParsingException: failed to parse date field <NON-DATE FIELD within obj_properties>

그래서 나는 obj_properties과 중첩 아무것도 날짜 감지 기능을 사용하지 않도록하고 싶습니다.

http://elasticsearch-users.115913.n3.nabble.com/Date-Detection-not-always-wanted-tp1638890p1639415.html

당 (참고, 내가 링크 된 게시물에 오타 포함 생각 - 필드 date_formats보다는 date_format해야한다,하지만 나는 두 가지를 시도했습니다)

나는 다음과 만든 매핑

mapping do 
    indexes :name 
    indexes :obj_properties, type: "object", date_formats: "none" 
    end 

하지만 계속 동일한 예외가 발생합니다. obj_properties의 속성은 미리 알 수 없으므로 철저한 유형 매핑을 만들 수 없습니다. 어떤 아이디어? 날짜 감지 기능을 사용하지 않도록 설정하는 것이 올바른 방법입니까?

답변

2

당신은 매핑을 지정하여 특정 type에 대한 날짜 감지 기능을 해제 할 수 있습니다

curl -XPUT 'http://127.0.0.1:9200/myindex/?pretty=1' -d ' 
{ 
    "mappings" : { 
     "mytype" : { 
     "date_detection" : 0 
     } 
    } 
} 
' 

하거나 기본 매핑을 지정하여 인덱스의 모든 유형에 대한 :

curl -XPUT 'http://127.0.0.1:9200/myindex/?pretty=1' -d ' 
{ 
    "mappings" : { 
     "_default_" : { 
     "date_detection" : 0 
     } 
    } 
} 
' 
1
mapping(date_detection: false) do 
    indexes :name 
    indexes :obj_properties, type: "object" 
end 

다음에 curl 'http://127.0.0.1:9200/myindex/_mapping?pretty=1'은 을 말합니다. here

비록 이것이 특정 색인이 아닌 전체 색인에 적용된다고 생각하지만