2014-04-16 3 views
0

나는 Elasticsearch 이미지 플러그인의 매핑으로 matadata를 정의했습니다.Elasticsearch 이미지 플러그인을 사용하여 메타 데이터를 얻는 방법

매핑 : 인덱스 후

"photo" : { 
    "mappings" : { 
    "scenery" : { 
     "properties" : { 
     "my_img" : { 
      "type" : "image", 
      "feature" : {"FCTH" : { }, ... }, 
      "metadata" : { 
      "jpeg.image_height" : {"type" : "string","store" : true}, 
      "jpeg.image_width" : {"type" : "string","store" : true} 
      } 
     } 
     } 
    } 
    } 
} 

, 검색 있지만, 메타 데이터는 반환하지 않습니다. 메타 데이터를 얻으려면 어떻게해야합니까?

는 I 시도 :

curl -XPOST 'localhost:9200/photo/scenery/_search' -d '{ 
    "query":{ 
    "image":{ 
     "my_img":{ 
     "feature":"CEDD", 
     "index":"photo", 
     "type":"scenery", 
     "id":"0", 
     "path":"my_img", 
     "hash":"BIT_SAMPLING" 
     } 
    } 
    } 
}' 

결과 :

{"took":14,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":5,"max_score":1.0,"hits":[{"_index":"photo","_type":"scenery","_id":"0","_score":1.0, "_source" : {"file_name": "376423.jpg", "my_img": "/9j/4AAQSkZJRgABAQ... 

답변

0

아마도, 원래의 데이터 (베이스 64 인코딩 된 이미지)를 반환한다 _source 필드. 대신 fields 옵션을 사용할 수 있습니다.

이 검색어를 입력하십시오.

curl -XPOST 'localhost:9200/photo/scenery/_search' -d '{ 
    "query":{ 
    ... 
    }, 
    "fields": ["my_img.metadata.jpeg.image_height","my_img.metadata.jpeg.image_width" ] 
}' 
관련 문제