1

型マッピング

{
  "pois-en": {
    "mappings": {
      "poi": {
        "properties": {
           "address": {
              "type": "string",
              "analyzer": "portuguese"
           },
           "city": {
              "type": "integer"
           },
           (...)
           "type": {
              "type": "integer"
           }
        }
      }
    }
  }
}

すべてを照会:

GET pois-en/_search
{
  "query":{
    "match_all":{}
  },
  "fields": ["city"]
}

戻り値:

"hits": [
     {
        "_index": "pois-en",
        "_type": "pois_poi",
        "_id": "491",
        "_score": 1,
        "fields": {
           "city": [
              91
           ]
        }
     },
     (...)

しかし、次を使用してフィルタリングすると:

GET pois-en/_search
{
    "query" : {
        "filtered" : { 
            "query" : {
                "match_all" : {} 
            },
            "filter" : {
                "term" : { 
                    "city" : 91
                }
            }
        }
    }
}

そのリターンは何もありません!

何が間違っているのかわかりません。Django と Elasticsearch の通信には、私は Elasticutils ( https://github.com/mozilla/elasticutils ) ですが、現在は Sense を使用してこれらのクエリを作成しています。

前もって感謝します

4

1 に答える 1

1

タイプ名が投稿 (poiおよびpois_poi) で一貫していません - 返されたドキュメントはマッピングと一致しません。

于 2015-01-02T12:44:20.673 に答える