elasticsearch:词条查询失败

给了一个步行者

我有一些文档的映射,并且查询agains条款确实失败。我不明白为什么:

"mappings":{
     "timeslot":{
            "properties":{
                 "FOB_IN":{
                        "type":"long"
                 },
                 "TRIGGER_CODE":{
                        "type":"long"
                 },
                 "FLIGHT_PHASE":{
                        "type":"long"
                 },
                 "REP16_TRIG":{
                        "type":"long"
                 },
                 "fwot":{
                        "type":"string"
                 },
                 "FOB_OUT":{
                        "type":"long"
                 },
                 "FP":{
                        "type":"long"
                 },
                 "FLTNB":{
                        "type":"string"
                 },
                 "Date":{
                        "format":"strict_date_optional_time||epoch_millis",
                        "type":"date"
                 }
            }
     }
}

TRIGGER_CODE例如,我可以对进行词条查询,并且效果很好

{
   "took": 1,
   "timed_out": false,
   "_shards": {
      "total": 1,
      "successful": 1,
      "failed": 0
   },
   "hits": {
      "total": 5,
      "max_score": 4.4446826,
      "hits": [
         {
            "_index": "merged-2016-04",
            "_type": "timeslot",
            "_id": "AVRS8VnirVLwfvMnwpXb",
            "_score": 4.4446826,
            "_source": {
               "Date": "2016-04-03T08:42:44+0000",
               "FLIGHT_PHASE": 20,
               "TRIGGER_CODE": 4000,
               "fwot": "A6-APA"
            }
         }
      ]
   }
}

现在对fwot反对确实失败了怎么了?

GET merged-2016-04/_search?size=1
{
    "query" : {
        "term" : { "fwot": "A6-APA"}
    }
}

{
   "took": 1,
   "timed_out": false,
   "_shards": {
      "total": 1,
      "successful": 1,
      "failed": 0
   },
   "hits": {
      "total": 0,
      "max_score": null,
      "hits": []
   }
}
安德烈·斯特凡(Andrei Stefan)

您需要为此"index": "not_analyzed"工作。并且您需要为数据重新索引以使上述更改生效。

这是映射更改和一些测试数据的命令的完整列表:

PUT /merged-2016-04
{
  "mappings": {
    "timeslot": {
      "properties": {
        "FOB_IN": {
          "type": "long"
        },
        "TRIGGER_CODE": {
          "type": "long"
        },
        "FLIGHT_PHASE": {
          "type": "long"
        },
        "REP16_TRIG": {
          "type": "long"
        },
        "fwot": {
          "type": "string",
          "index": "not_analyzed"
        },
        "FOB_OUT": {
          "type": "long"
        },
        "FP": {
          "type": "long"
        },
        "FLTNB": {
          "type": "string"
        },
        "Date": {
          "format": "strict_date_optional_time||epoch_millis",
          "type": "date"
        }
      }
    }
  }
}

POST /merged-2016-04/timeslot
{
  "Date": "2016-04-03T08:42:44+0000",
  "FLIGHT_PHASE": 20,
  "TRIGGER_CODE": 4000,
  "fwot": "A6-APA"
}

GET merged-2016-04/_search?size=1
{
  "query": {
    "term": {
      "fwot": "A6-APA"
    }
  }
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章