I defined matadata by the mapping of the Elasticsearch image Plugin.

Mapping:

"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}
          }
        }
      }
    }
  }
}

After an index, although searched, metadata does not return. How do I get a metadata?

I tried:

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"
      }
    }
  }
}'

Result:

{"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...
有帮助吗?

解决方案

Perhaps, the original data (base64 encoded image) will be returned _source field. You can use that instead, the fields option.

Try this query.

curl -XPOST 'localhost:9200/photo/scenery/_search' -d '{
  "query":{
    ...
  },
  "fields": ["my_img.metadata.jpeg.image_height","my_img.metadata.jpeg.image_width" ]
}'
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top