Hi,
I want to index mysql data. My problem is date field in mysql. Some data format is 0000-00-00. I can't index them with Elasticsearch 2.3.2. I am using sense editor and Php code.
$ihale="SELECT I.*, D.detay, C.cetvel
FROM admin_ihale.tbl_ihale I
LEFT JOIN admin_ihale.tbl_ihale_detay D
ON I.id=D.id
LEFT JOIN admin_ihale.tbl_ihale_detay_cetvel C
ON I.id=C.id";
foreach($ihaleler as $ihale){
$id=$ihale['id'];
if($id>0){
$params=array();
$dizi=array();
$dizi['id']=$id*1;
$dizi['last_date']=$ihale['last_date'];
Where should I use this code (SELECT IF(last_date='0000-00-00 00:00:00',NULL,last_date) FROM TABLE)?
if($page=='index'){
$db->orderBy('id','asc');
$ihaleler=$db->get('tbl_ihale');
$ihale="SELECT I.*, D.detay, C.cetvel,
IF(last_date='0000-00-00',NULL,last_date)
FROM admin_ihale.tbl_ihale I
LEFT JOIN admin_ihale.tbl_ihale_detay D
ON I.id=D.id
LEFT JOIN admin_ihale.tbl_ihale_detay_cetvel C
ON I.id=C.id";
foreach($ihaleler as $ihale){
$id=$ihale['id'];
if($id>0){
$params=array();
$dizi=array();
$dizi['id']=$id*1;
$dizi['last_date']=$ihale['last_date'];
My error :
Fatal error: Uncaught exception 'Elasticsearch\Common\Exceptions\BadRequest400Exception' with message '{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"failed to parse [son_sonuc_tarihi]"}],"type":"mapper_parsing_exception","reason":"failed to parse [son_sonuc_tarihi]","caused_by":{"type":"illegal_field_value_exception","reason":"Cannot parse \"0000-00-00\": Value 0 for monthOfYear must be in the range [1,12]"}},"status":400}' in /home/admin/web/localhost/public_html/proje_ihale/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:655 Stack trace: #0 /home/admin/web/localhost/public_html/proje_ihale/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(632): Elasticsearch\Connections\Connection->tryDeserializeError(Array, 'Elasticsearch\\C...') #1 /home/admin/web/localhost/public_html/proje_ihale/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(553): Elasticsearch\Connections\Connection->tryDeserialize400Error(Array) #2 in /home/admin/web/localhost/public_html/proje_ihale/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php on line 657
if($page=='index'){
$db->orderBy('id','asc');
$ihaleler=$db->get('tbl_ihale');
$ihale="SELECT I.*, D.detay, C.cetvel
FROM admin_ihale.tbl_ihale I
LEFT JOIN admin_ihale.tbl_ihale_detay D
ON I.id=D.id
LEFT JOIN admin_ihale.tbl_ihale_detay_cetvel C
ON I.id=C.id";
foreach($ihaleler as $ihale){
$id=$ihale['id'];
if($id>0){
$params=array();
$dizi=array();
$dizi['id']=$id*1;
if($ihale['last_date'] == '0000-00-00'){
$ihale['last_date'] = NULL;
}
$dizi['last_date']=$ihale['last_date'];//null
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.