Elastic search NumberFormatException aggregation terms query

1.6k views Asked by At

I don't know what I am doing wrong. I have a term aggregation over an integer field "status", but am getting NumberFormatException by running the query. I have 2 status fields one is in _source.status with type integer and one is _source.report.status with type long

Error message

{
  "error": "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed;
            shardFailures {[qIeOaS8SS4ynp938pIXZyg][outboxprov1][3]:
            ElasticsearchException[java.lang.NumberFormatException:
            Invalid shift value in prefixCoded bytes (is encoded value really an INT?)]; 
              nested: UncheckedExecutionException[java.lang.NumberFormatException:
                      Invalid shift value in prefixCoded bytes (is encoded value really an INT?)]; 
              nested: NumberFormatException[Invalid shift value in prefixCoded bytes (is encoded value really an INT?)]; }{[qIeOaS8SS4ynp938pIXZyg][outboxprov1][4]:
            ElasticsearchException[java.lang.NumberFormatException:
            Invalid shift value in prefixCoded bytes (is encoded value really an INT?)];
              nested: UncheckedExecutionException[java.lang.NumberFormatException: 
                      Invalid shift value in prefixCoded bytes (is encoded value really an INT?)]; 
              nested: NumberFormatException[Invalid shift value in prefixCoded bytes (is encoded value really an INT?)]; }{[qIeOaS8SS4ynp938pIXZyg][outboxprov1][0]:
            ElasticsearchException[java.lang.NumberFormatException: 
            Invalid shift value in prefixCoded bytes (is encoded value really an INT?)]; 
              nested: UncheckedExecutionException[java.lang.NumberFormatException: 
                      Invalid shift value in prefixCoded bytes (is encoded value really an INT?)]; 
              nested: NumberFormatException[Invalid shift value in prefixCoded bytes (is encoded value really an INT?)]; }{[qIeOaS8SS4ynp938pIXZyg][outboxprov1][1]: 
            ElasticsearchException[java.lang.NumberFormatException: 
            Invalid shift value in prefixCoded bytes (is encoded value really an INT?)]; 
              nested: UncheckedExecutionException[java.lang.NumberFormatException: 
                      Invalid shift value in prefixCoded bytes (is encoded value really an INT?)]; 
              nested: NumberFormatException[Invalid shift value in prefixCoded bytes (is encoded value really an INT?)]; }{[qIeOaS8SS4ynp938pIXZyg][outboxprov1][2]:
            ElasticsearchException[java.lang.NumberFormatException: 
            Invalid shift value in prefixCoded bytes (is encoded value really an INT?)]; 
              nested: UncheckedExecutionException[java.lang.NumberFormatException: 
                      Invalid shift value in prefixCoded bytes (is encoded value really an INT?)]; 
              nested: NumberFormatException[Invalid shift value in prefixCoded bytes (is encoded value really an INT?)]; }]",
  "status": 500
}

Query

{
  "size": 0,
  "query": {
    "match_all": {}
  },
  "aggs": {
    "total": {
      "terms": {
        "field": "status", // type : "integer"
        "order": {
          "_term": "asc"
        }
      }
    },
    "immediate_total": {
      "terms": {
        "field": "immediate",
        "order": {
          "_term": "asc"
        }
      }
    },
    "daily_post_count": {
      "filter": {
        "range": {
          "created_date": {
            "from": "2014-11-27",
            "to": "2014-11-27"
          }
        }
      },
      "aggs": {
        "today_posts": {
          "terms": {
            "field": "status", // type : "integer"
            "order": {
              "_term": "asc"
            }
          }
        },
        "today_immediate": {
          "terms": {
            "field": "immediate",
            "order": {
              "_term": "asc"
            }
          }
        }
      }
    }
  }
}

Mapping

{
   "test": {
      "mappings": {
         "message": {
            "properties": {
               "approved_date": {
                  "type": "date",
                  "format": "dateOptionalTime"
               },
               "approver": {
                  "type": "string"
               },
               "content": {
                  "type": "string",
                  "store": true
               },
               "contents": {
                  "properties": {
                     "'facebook'": {
                        "type": "string"
                     },
                     "approver": {
                        "type": "string"
                     },
                     "contents": {
                        "type": "string"
                     },
                     "created_date": {
                        "type": "date",
                        "format": "dateOptionalTime"
                     },
                     "facebok": {
                        "type": "string"
                     },
                     "facebook": {
                        "type": "string"
                     },
                     "failed": {
                        "type": "long"
                     },
                     "hash": {
                        "type": "string"
                     },
                     "immediate": {
                        "type": "long"
                     },
                     "link": {
                        "type": "string"
                     },
                     "linkedin": {
                        "type": "string"
                     },
                     "message_date": {
                        "type": "date",
                        "format": "dateOptionalTime"
                     },
                     "network_connectors": {
                        "type": "string"
                     },
                     "post_count": {
                        "type": "long"
                     },
                     "preview": {
                        "type": "string"
                     },
                     "preview_description": {
                        "type": "string"
                     },
                     "preview_image_url": {
                        "type": "string"
                     },
                     "preview_title": {
                        "type": "string"
                     },
                     "sent": {
                        "type": "long"
                     },
                     "status": {
                        "type": "long"
                     },
                     "twitter": {
                        "type": "string"
                     }
                  }
               },
               "created_date": {
                  "type": "date",
                  "format": "dateOptionalTime"
               },
               "created_ip": {
                  "type": "ip"
               },
               "created_user": {
                  "type": "string",
                  "index": "not_analyzed"
               },
               "failed": {
                  "type": "long"
               },
               "folder": {
                  "type": "integer"
               },
               "hash": {
                  "type": "string"
               },
               "immediate": {
                  "type": "long"
               },
               "link": {
                  "type": "string"
               },
               "message_date": {
                  "type": "date",
                  "format": "dateOptionalTime"
               },
               "modified_date": {
                  "type": "date",
                  "format": "dateOptionalTime"
               },
               "network_connectors": {
                  "type": "string",
                  "index": "not_analyzed"
               },
               "post_count": {
                  "type": "long"
               },
               "preview": {
                  "type": "string"
               },
               "preview_description": {
                  "type": "string"
               },
               "preview_image_url": {
                  "type": "string"
               },
               "preview_title": {
                  "type": "string"
               },
               "report": {
                  "properties": {
                     "info": {
                        "type": "string"
                     },
                     "networks": {
                        "type": "string"
                     },
                     "status": {
                        "type": "long"
                     }
                  }
               },
               "sent": {
                  "type": "long"
               },
               "status": {
                  "type": "integer"
               },
               "team_id": {
                  "type": "string",
                  "index": "not_analyzed"
               }
            }
         }
      }
   }
}

Please help me to solve this issue. Thank you.

0

There are 0 answers