equal
deleted
inserted
replaced
55 return 0; |
55 return 0; |
56 } |
56 } |
57 } |
57 } |
58 $indexParams['body'] = [ |
58 $indexParams['body'] = [ |
59 'settings' => [ |
59 'settings' => [ |
60 'number_of_shards' => env('ELASTICSEARCH_SHARDS'), |
60 'number_of_shards' => conf('elasticsearch.shards'), |
61 'number_of_replicas' => env('ELASTICSEARCH_REPLICAS'), |
61 'number_of_replicas' => conf('elasticsearch.replicas'), |
62 'index.mapping.ignore_malformed' => True |
62 'index.mapping.ignore_malformed' => True |
63 ], |
63 ], |
64 'mappings' => [ |
64 'mappings' => [ |
65 'document' => [ |
65 'document' => [ |
66 'properties' => [ |
66 'properties' => [ |
95 * @return int (1 if sucess, 0 if error) |
95 * @return int (1 if sucess, 0 if error) |
96 */ |
96 */ |
97 private function indexOne($doc) |
97 private function indexOne($doc) |
98 { |
98 { |
99 $query_data = [ |
99 $query_data = [ |
100 'index' => env('ELASTICSEARCH_INDEX'), |
100 'index' => conf('elasticsearch.index'), |
101 'type' => 'document', |
101 'type' => 'document', |
102 'id' => (string)$doc->getId(), |
102 'id' => (string)$doc->getId(), |
103 'body' => [ |
103 'body' => [ |
104 'title' => (string)$doc->getTitle(), |
104 'title' => (string)$doc->getTitle(), |
105 'date' => (string)$doc->getModified() |
105 'date' => (string)$doc->getModified() |
117 { |
117 { |
118 $query_data = ['body' => []]; |
118 $query_data = ['body' => []]; |
119 foreach($docs as $doc){ |
119 foreach($docs as $doc){ |
120 $query_data['body'][] = [ |
120 $query_data['body'][] = [ |
121 'index' => [ |
121 'index' => [ |
122 '_index' => env('ELASTICSEARCH_INDEX'), |
122 '_index' => conf('elasticsearch.index'), |
123 '_type' => 'document', |
123 '_type' => 'document', |
124 '_id' => (string)$doc->getId() |
124 '_id' => (string)$doc->getId() |
125 ] |
125 ] |
126 ]; |
126 ]; |
127 $query_data['body'][] = [ |
127 $query_data['body'][] = [ |